Fix interface attributes setters using wrong JS method names (#4170)

This commit is contained in:
James Lindsay 2024-10-10 20:33:46 +01:00 committed by GitHub
parent 0e89a29719
commit 76013f200c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 101 additions and 96 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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<f64>);
# [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<u32>);
# [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]

View File

@ -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(

View File

@ -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(

View File

@ -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 = ""]

View File

@ -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 = ""]

View File

@ -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."]

View File

@ -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."]

View File

@ -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<String>, ty: &impl TraverseType) {
@ -236,6 +236,7 @@ pub enum InterfaceAttributeKind {
pub struct InterfaceAttribute {
pub js_name: String,
pub rust_name: String,
pub deprecated: Option<Option<String>>,
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; ),
)
}
};

View File

@ -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,