Skip to content

Commit b5e9e08

Browse files
committed
Deprecate builder-pattern setters for WebIDL dictionaries
1 parent bb084e5 commit b5e9e08

File tree

553 files changed

+15200
-11992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

553 files changed

+15200
-11992
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
* Update and stabilize the Clipboard API.
6666
[#3992](https://github.com/rustwasm/wasm-bindgen/pull/3992)
6767

68+
* Deprecate builder-pattern type setters for WebIDL dictionary types and introduce non-mutable setters instead.
69+
[#3993](https://github.com/rustwasm/wasm-bindgen/pull/3993)
70+
6871
### Fixed
6972

7073
* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`.

crates/web-sys/src/features/gen_AddEventListenerOptions.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,31 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
1616
#[wasm_bindgen(method, getter = "capture")]
1717
pub fn get_capture(this: &AddEventListenerOptions) -> Option<bool>;
18+
#[doc = "Change the `capture` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
1821
#[wasm_bindgen(method, setter = "capture")]
19-
fn set_capture(this: &AddEventListenerOptions, val: bool);
22+
pub fn set_capture(this: &AddEventListenerOptions, val: bool);
2023
#[doc = "Get the `once` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
2326
#[wasm_bindgen(method, getter = "once")]
2427
pub fn get_once(this: &AddEventListenerOptions) -> Option<bool>;
28+
#[doc = "Change the `once` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
2531
#[wasm_bindgen(method, setter = "once")]
26-
fn set_once(this: &AddEventListenerOptions, val: bool);
32+
pub fn set_once(this: &AddEventListenerOptions, val: bool);
2733
#[doc = "Get the `passive` field of this object."]
2834
#[doc = ""]
2935
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
3036
#[wasm_bindgen(method, getter = "passive")]
3137
pub fn get_passive(this: &AddEventListenerOptions) -> Option<bool>;
38+
#[doc = "Change the `passive` field of this object."]
39+
#[doc = ""]
40+
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
3241
#[wasm_bindgen(method, setter = "passive")]
33-
fn set_passive(this: &AddEventListenerOptions, val: bool);
42+
pub fn set_passive(this: &AddEventListenerOptions, val: bool);
3443
}
3544
impl AddEventListenerOptions {
3645
#[doc = "Construct a new `AddEventListenerOptions`."]
@@ -41,23 +50,17 @@ impl AddEventListenerOptions {
4150
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
4251
ret
4352
}
44-
#[doc = "Change the `capture` field of this object."]
45-
#[doc = ""]
46-
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
53+
#[deprecated = "Use `set_capture()` instead."]
4754
pub fn capture(&mut self, val: bool) -> &mut Self {
4855
self.set_capture(val);
4956
self
5057
}
51-
#[doc = "Change the `once` field of this object."]
52-
#[doc = ""]
53-
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
58+
#[deprecated = "Use `set_once()` instead."]
5459
pub fn once(&mut self, val: bool) -> &mut Self {
5560
self.set_once(val);
5661
self
5762
}
58-
#[doc = "Change the `passive` field of this object."]
59-
#[doc = ""]
60-
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
63+
#[deprecated = "Use `set_passive()` instead."]
6164
pub fn passive(&mut self, val: bool) -> &mut Self {
6265
self.set_passive(val);
6366
self

crates/web-sys/src/features/gen_AesCbcParams.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesCbcParams) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesCbcParams, val: &str);
22+
pub fn set_name(this: &AesCbcParams, val: &str);
2023
#[doc = "Get the `iv` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
2326
#[wasm_bindgen(method, getter = "iv")]
2427
pub fn get_iv(this: &AesCbcParams) -> ::js_sys::Object;
28+
#[doc = "Change the `iv` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
2531
#[wasm_bindgen(method, setter = "iv")]
26-
fn set_iv(this: &AesCbcParams, val: &::js_sys::Object);
32+
pub fn set_iv(this: &AesCbcParams, val: &::js_sys::Object);
2733
}
2834
impl AesCbcParams {
2935
#[doc = "Construct a new `AesCbcParams`."]
@@ -36,16 +42,12 @@ impl AesCbcParams {
3642
ret.iv(iv);
3743
ret
3844
}
39-
#[doc = "Change the `name` field of this object."]
40-
#[doc = ""]
41-
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
45+
#[deprecated = "Use `set_name()` instead."]
4246
pub fn name(&mut self, val: &str) -> &mut Self {
4347
self.set_name(val);
4448
self
4549
}
46-
#[doc = "Change the `iv` field of this object."]
47-
#[doc = ""]
48-
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
50+
#[deprecated = "Use `set_iv()` instead."]
4951
pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self {
5052
self.set_iv(val);
5153
self

crates/web-sys/src/features/gen_AesCtrParams.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,31 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesCtrParams) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesCtrParams, val: &str);
22+
pub fn set_name(this: &AesCtrParams, val: &str);
2023
#[doc = "Get the `counter` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
2326
#[wasm_bindgen(method, getter = "counter")]
2427
pub fn get_counter(this: &AesCtrParams) -> ::js_sys::Object;
28+
#[doc = "Change the `counter` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
2531
#[wasm_bindgen(method, setter = "counter")]
26-
fn set_counter(this: &AesCtrParams, val: &::js_sys::Object);
32+
pub fn set_counter(this: &AesCtrParams, val: &::js_sys::Object);
2733
#[doc = "Get the `length` field of this object."]
2834
#[doc = ""]
2935
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
3036
#[wasm_bindgen(method, getter = "length")]
3137
pub fn get_length(this: &AesCtrParams) -> u8;
38+
#[doc = "Change the `length` field of this object."]
39+
#[doc = ""]
40+
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
3241
#[wasm_bindgen(method, setter = "length")]
33-
fn set_length(this: &AesCtrParams, val: u8);
42+
pub fn set_length(this: &AesCtrParams, val: u8);
3443
}
3544
impl AesCtrParams {
3645
#[doc = "Construct a new `AesCtrParams`."]
@@ -44,23 +53,17 @@ impl AesCtrParams {
4453
ret.length(length);
4554
ret
4655
}
47-
#[doc = "Change the `name` field of this object."]
48-
#[doc = ""]
49-
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
56+
#[deprecated = "Use `set_name()` instead."]
5057
pub fn name(&mut self, val: &str) -> &mut Self {
5158
self.set_name(val);
5259
self
5360
}
54-
#[doc = "Change the `counter` field of this object."]
55-
#[doc = ""]
56-
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
61+
#[deprecated = "Use `set_counter()` instead."]
5762
pub fn counter(&mut self, val: &::js_sys::Object) -> &mut Self {
5863
self.set_counter(val);
5964
self
6065
}
61-
#[doc = "Change the `length` field of this object."]
62-
#[doc = ""]
63-
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
66+
#[deprecated = "Use `set_length()` instead."]
6467
pub fn length(&mut self, val: u8) -> &mut Self {
6568
self.set_length(val);
6669
self

crates/web-sys/src/features/gen_AesDerivedKeyParams.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesDerivedKeyParams) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesDerivedKeyParams, val: &str);
22+
pub fn set_name(this: &AesDerivedKeyParams, val: &str);
2023
#[doc = "Get the `length` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
2326
#[wasm_bindgen(method, getter = "length")]
2427
pub fn get_length(this: &AesDerivedKeyParams) -> u32;
28+
#[doc = "Change the `length` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
2531
#[wasm_bindgen(method, setter = "length")]
26-
fn set_length(this: &AesDerivedKeyParams, val: u32);
32+
pub fn set_length(this: &AesDerivedKeyParams, val: u32);
2733
}
2834
impl AesDerivedKeyParams {
2935
#[doc = "Construct a new `AesDerivedKeyParams`."]
@@ -36,16 +42,12 @@ impl AesDerivedKeyParams {
3642
ret.length(length);
3743
ret
3844
}
39-
#[doc = "Change the `name` field of this object."]
40-
#[doc = ""]
41-
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
45+
#[deprecated = "Use `set_name()` instead."]
4246
pub fn name(&mut self, val: &str) -> &mut Self {
4347
self.set_name(val);
4448
self
4549
}
46-
#[doc = "Change the `length` field of this object."]
47-
#[doc = ""]
48-
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
50+
#[deprecated = "Use `set_length()` instead."]
4951
pub fn length(&mut self, val: u32) -> &mut Self {
5052
self.set_length(val);
5153
self

crates/web-sys/src/features/gen_AesGcmParams.rs

+20-16
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,41 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesGcmParams) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesGcmParams, val: &str);
22+
pub fn set_name(this: &AesGcmParams, val: &str);
2023
#[doc = "Get the `additionalData` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
2326
#[wasm_bindgen(method, getter = "additionalData")]
2427
pub fn get_additional_data(this: &AesGcmParams) -> Option<::js_sys::Object>;
28+
#[doc = "Change the `additionalData` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
2531
#[wasm_bindgen(method, setter = "additionalData")]
26-
fn set_additional_data(this: &AesGcmParams, val: &::js_sys::Object);
32+
pub fn set_additional_data(this: &AesGcmParams, val: &::js_sys::Object);
2733
#[doc = "Get the `iv` field of this object."]
2834
#[doc = ""]
2935
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
3036
#[wasm_bindgen(method, getter = "iv")]
3137
pub fn get_iv(this: &AesGcmParams) -> ::js_sys::Object;
38+
#[doc = "Change the `iv` field of this object."]
39+
#[doc = ""]
40+
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
3241
#[wasm_bindgen(method, setter = "iv")]
33-
fn set_iv(this: &AesGcmParams, val: &::js_sys::Object);
42+
pub fn set_iv(this: &AesGcmParams, val: &::js_sys::Object);
3443
#[doc = "Get the `tagLength` field of this object."]
3544
#[doc = ""]
3645
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
3746
#[wasm_bindgen(method, getter = "tagLength")]
3847
pub fn get_tag_length(this: &AesGcmParams) -> Option<u8>;
48+
#[doc = "Change the `tagLength` field of this object."]
49+
#[doc = ""]
50+
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
3951
#[wasm_bindgen(method, setter = "tagLength")]
40-
fn set_tag_length(this: &AesGcmParams, val: u8);
52+
pub fn set_tag_length(this: &AesGcmParams, val: u8);
4153
}
4254
impl AesGcmParams {
4355
#[doc = "Construct a new `AesGcmParams`."]
@@ -50,30 +62,22 @@ impl AesGcmParams {
5062
ret.iv(iv);
5163
ret
5264
}
53-
#[doc = "Change the `name` field of this object."]
54-
#[doc = ""]
55-
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
65+
#[deprecated = "Use `set_name()` instead."]
5666
pub fn name(&mut self, val: &str) -> &mut Self {
5767
self.set_name(val);
5868
self
5969
}
60-
#[doc = "Change the `additionalData` field of this object."]
61-
#[doc = ""]
62-
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
70+
#[deprecated = "Use `set_additional_data()` instead."]
6371
pub fn additional_data(&mut self, val: &::js_sys::Object) -> &mut Self {
6472
self.set_additional_data(val);
6573
self
6674
}
67-
#[doc = "Change the `iv` field of this object."]
68-
#[doc = ""]
69-
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
75+
#[deprecated = "Use `set_iv()` instead."]
7076
pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self {
7177
self.set_iv(val);
7278
self
7379
}
74-
#[doc = "Change the `tagLength` field of this object."]
75-
#[doc = ""]
76-
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
80+
#[deprecated = "Use `set_tag_length()` instead."]
7781
pub fn tag_length(&mut self, val: u8) -> &mut Self {
7882
self.set_tag_length(val);
7983
self

crates/web-sys/src/features/gen_AesKeyAlgorithm.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesKeyAlgorithm) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesKeyAlgorithm, val: &str);
22+
pub fn set_name(this: &AesKeyAlgorithm, val: &str);
2023
#[doc = "Get the `length` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
2326
#[wasm_bindgen(method, getter = "length")]
2427
pub fn get_length(this: &AesKeyAlgorithm) -> u16;
28+
#[doc = "Change the `length` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
2531
#[wasm_bindgen(method, setter = "length")]
26-
fn set_length(this: &AesKeyAlgorithm, val: u16);
32+
pub fn set_length(this: &AesKeyAlgorithm, val: u16);
2733
}
2834
impl AesKeyAlgorithm {
2935
#[doc = "Construct a new `AesKeyAlgorithm`."]
@@ -36,16 +42,12 @@ impl AesKeyAlgorithm {
3642
ret.length(length);
3743
ret
3844
}
39-
#[doc = "Change the `name` field of this object."]
40-
#[doc = ""]
41-
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
45+
#[deprecated = "Use `set_name()` instead."]
4246
pub fn name(&mut self, val: &str) -> &mut Self {
4347
self.set_name(val);
4448
self
4549
}
46-
#[doc = "Change the `length` field of this object."]
47-
#[doc = ""]
48-
#[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"]
50+
#[deprecated = "Use `set_length()` instead."]
4951
pub fn length(&mut self, val: u16) -> &mut Self {
5052
self.set_length(val);
5153
self

crates/web-sys/src/features/gen_AesKeyGenParams.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ extern "C" {
1515
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
1616
#[wasm_bindgen(method, getter = "name")]
1717
pub fn get_name(this: &AesKeyGenParams) -> String;
18+
#[doc = "Change the `name` field of this object."]
19+
#[doc = ""]
20+
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
1821
#[wasm_bindgen(method, setter = "name")]
19-
fn set_name(this: &AesKeyGenParams, val: &str);
22+
pub fn set_name(this: &AesKeyGenParams, val: &str);
2023
#[doc = "Get the `length` field of this object."]
2124
#[doc = ""]
2225
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
2326
#[wasm_bindgen(method, getter = "length")]
2427
pub fn get_length(this: &AesKeyGenParams) -> u16;
28+
#[doc = "Change the `length` field of this object."]
29+
#[doc = ""]
30+
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
2531
#[wasm_bindgen(method, setter = "length")]
26-
fn set_length(this: &AesKeyGenParams, val: u16);
32+
pub fn set_length(this: &AesKeyGenParams, val: u16);
2733
}
2834
impl AesKeyGenParams {
2935
#[doc = "Construct a new `AesKeyGenParams`."]
@@ -36,16 +42,12 @@ impl AesKeyGenParams {
3642
ret.length(length);
3743
ret
3844
}
39-
#[doc = "Change the `name` field of this object."]
40-
#[doc = ""]
41-
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
45+
#[deprecated = "Use `set_name()` instead."]
4246
pub fn name(&mut self, val: &str) -> &mut Self {
4347
self.set_name(val);
4448
self
4549
}
46-
#[doc = "Change the `length` field of this object."]
47-
#[doc = ""]
48-
#[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"]
50+
#[deprecated = "Use `set_length()` instead."]
4951
pub fn length(&mut self, val: u16) -> &mut Self {
5052
self.set_length(val);
5153
self

0 commit comments

Comments
 (0)