Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement getters for WebIDL dictionaries #3933

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
  •  
  •  
  •  
46 changes: 40 additions & 6 deletions crates/web-sys/src/features/gen_AddEventListenerOptions.rs
Expand Up @@ -10,12 +10,46 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
pub type AddEventListenerOptions;
#[wasm_bindgen(method, getter = "capture")]
fn capture_shim(this: &AddEventListenerOptions) -> bool;
#[wasm_bindgen(method, setter = "capture")]
fn capture_shim(this: &AddEventListenerOptions, val: bool);
fn set_capture_shim(this: &AddEventListenerOptions, val: bool);
#[wasm_bindgen(method, getter = "once")]
fn once_shim(this: &AddEventListenerOptions) -> bool;
#[wasm_bindgen(method, setter = "once")]
fn once_shim(this: &AddEventListenerOptions, val: bool);
fn set_once_shim(this: &AddEventListenerOptions, val: bool);
#[wasm_bindgen(method, getter = "passive")]
fn passive_shim(this: &AddEventListenerOptions) -> bool;
#[wasm_bindgen(method, setter = "passive")]
fn passive_shim(this: &AddEventListenerOptions, val: bool);
fn set_passive_shim(this: &AddEventListenerOptions, val: bool);
}
#[doc = "The trait to access properties on the `AddEventListenerOptions` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
pub trait AddEventListenerOptionsGetters {
#[doc = "Get the `capture` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
fn capture(&self) -> bool;
#[doc = "Get the `once` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
fn once(&self) -> bool;
#[doc = "Get the `passive` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"]
fn passive(&self) -> bool;
}
impl AddEventListenerOptionsGetters for AddEventListenerOptions {
fn capture(&self) -> bool {
self.capture_shim()
}
fn once(&self) -> bool {
self.once_shim()
}
fn passive(&self) -> bool {
self.passive_shim()
}
}
impl AddEventListenerOptions {
#[doc = "Construct a new `AddEventListenerOptions`."]
Expand All @@ -30,21 +64,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 {
self.capture_shim(val);
self.set_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 {
self.once_shim(val);
self.set_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 {
self.passive_shim(val);
self.set_passive_shim(val);
self
}
}
Expand Down
37 changes: 31 additions & 6 deletions crates/web-sys/src/features/gen_AesCbcParams.rs
Expand Up @@ -10,10 +10,35 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
pub type AesCbcParams;
#[wasm_bindgen(method, getter = "name")]
fn name_shim(this: &AesCbcParams) -> String;
#[wasm_bindgen(method, setter = "name")]
fn name_shim(this: &AesCbcParams, val: &str);
fn set_name_shim(this: &AesCbcParams, val: &str);
#[wasm_bindgen(method, getter = "iv")]
fn iv_shim(this: &AesCbcParams) -> ::js_sys::Object;
#[wasm_bindgen(method, setter = "iv")]
fn iv_shim(this: &AesCbcParams, val: &::js_sys::Object);
fn set_iv_shim(this: &AesCbcParams, val: &::js_sys::Object);
}
#[doc = "The trait to access properties on the `AesCbcParams` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
pub trait AesCbcParamsGetters {
#[doc = "Get the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
fn name(&self) -> String;
#[doc = "Get the `iv` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
fn iv(&self) -> ::js_sys::Object;
}
impl AesCbcParamsGetters for AesCbcParams {
fn name(&self) -> String {
self.name_shim()
}
fn iv(&self) -> ::js_sys::Object {
self.iv_shim()
}
}
impl AesCbcParams {
#[doc = "Construct a new `AesCbcParams`."]
Expand All @@ -22,22 +47,22 @@ 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);
Self::name(&mut ret, name);
Self::iv(&mut ret, iv);
ret
}
#[doc = "Change the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"]
pub fn name(&mut self, val: &str) -> &mut Self {
self.name_shim(val);
self.set_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 {
self.iv_shim(val);
self.set_iv_shim(val);
self
}
}
52 changes: 43 additions & 9 deletions crates/web-sys/src/features/gen_AesCtrParams.rs
Expand Up @@ -10,12 +10,46 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
pub type AesCtrParams;
#[wasm_bindgen(method, getter = "name")]
fn name_shim(this: &AesCtrParams) -> String;
#[wasm_bindgen(method, setter = "name")]
fn name_shim(this: &AesCtrParams, val: &str);
fn set_name_shim(this: &AesCtrParams, val: &str);
#[wasm_bindgen(method, getter = "counter")]
fn counter_shim(this: &AesCtrParams) -> ::js_sys::Object;
#[wasm_bindgen(method, setter = "counter")]
fn counter_shim(this: &AesCtrParams, val: &::js_sys::Object);
fn set_counter_shim(this: &AesCtrParams, val: &::js_sys::Object);
#[wasm_bindgen(method, getter = "length")]
fn length_shim(this: &AesCtrParams) -> u8;
#[wasm_bindgen(method, setter = "length")]
fn length_shim(this: &AesCtrParams, val: u8);
fn set_length_shim(this: &AesCtrParams, val: u8);
}
#[doc = "The trait to access properties on the `AesCtrParams` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
pub trait AesCtrParamsGetters {
#[doc = "Get the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
fn name(&self) -> String;
#[doc = "Get the `counter` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
fn counter(&self) -> ::js_sys::Object;
#[doc = "Get the `length` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
fn length(&self) -> u8;
}
impl AesCtrParamsGetters for AesCtrParams {
fn name(&self) -> String {
self.name_shim()
}
fn counter(&self) -> ::js_sys::Object {
self.counter_shim()
}
fn length(&self) -> u8 {
self.length_shim()
}
}
impl AesCtrParams {
#[doc = "Construct a new `AesCtrParams`."]
Expand All @@ -24,30 +58,30 @@ 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);
Self::name(&mut ret, name);
Self::counter(&mut ret, counter);
Self::length(&mut ret, length);
ret
}
#[doc = "Change the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"]
pub fn name(&mut self, val: &str) -> &mut Self {
self.name_shim(val);
self.set_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 {
self.counter_shim(val);
self.set_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 {
self.length_shim(val);
self.set_length_shim(val);
self
}
}
37 changes: 31 additions & 6 deletions crates/web-sys/src/features/gen_AesDerivedKeyParams.rs
Expand Up @@ -10,10 +10,35 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
pub type AesDerivedKeyParams;
#[wasm_bindgen(method, getter = "name")]
fn name_shim(this: &AesDerivedKeyParams) -> String;
#[wasm_bindgen(method, setter = "name")]
fn name_shim(this: &AesDerivedKeyParams, val: &str);
fn set_name_shim(this: &AesDerivedKeyParams, val: &str);
#[wasm_bindgen(method, getter = "length")]
fn length_shim(this: &AesDerivedKeyParams) -> u32;
#[wasm_bindgen(method, setter = "length")]
fn length_shim(this: &AesDerivedKeyParams, val: u32);
fn set_length_shim(this: &AesDerivedKeyParams, val: u32);
}
#[doc = "The trait to access properties on the `AesDerivedKeyParams` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
pub trait AesDerivedKeyParamsGetters {
#[doc = "Get the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
fn name(&self) -> String;
#[doc = "Get the `length` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
fn length(&self) -> u32;
}
impl AesDerivedKeyParamsGetters for AesDerivedKeyParams {
fn name(&self) -> String {
self.name_shim()
}
fn length(&self) -> u32 {
self.length_shim()
}
}
impl AesDerivedKeyParams {
#[doc = "Construct a new `AesDerivedKeyParams`."]
Expand All @@ -22,22 +47,22 @@ 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);
Self::name(&mut ret, name);
Self::length(&mut ret, length);
ret
}
#[doc = "Change the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"]
pub fn name(&mut self, val: &str) -> &mut Self {
self.name_shim(val);
self.set_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 {
self.length_shim(val);
self.set_length_shim(val);
self
}
}
63 changes: 53 additions & 10 deletions crates/web-sys/src/features/gen_AesGcmParams.rs
Expand Up @@ -10,14 +10,57 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
pub type AesGcmParams;
#[wasm_bindgen(method, getter = "name")]
fn name_shim(this: &AesGcmParams) -> String;
#[wasm_bindgen(method, setter = "name")]
fn name_shim(this: &AesGcmParams, val: &str);
fn set_name_shim(this: &AesGcmParams, val: &str);
#[wasm_bindgen(method, getter = "additionalData")]
fn additional_data_shim(this: &AesGcmParams) -> ::js_sys::Object;
#[wasm_bindgen(method, setter = "additionalData")]
fn additional_data_shim(this: &AesGcmParams, val: &::js_sys::Object);
fn set_additional_data_shim(this: &AesGcmParams, val: &::js_sys::Object);
#[wasm_bindgen(method, getter = "iv")]
fn iv_shim(this: &AesGcmParams) -> ::js_sys::Object;
#[wasm_bindgen(method, setter = "iv")]
fn iv_shim(this: &AesGcmParams, val: &::js_sys::Object);
fn set_iv_shim(this: &AesGcmParams, val: &::js_sys::Object);
#[wasm_bindgen(method, getter = "tagLength")]
fn tag_length_shim(this: &AesGcmParams) -> u8;
#[wasm_bindgen(method, setter = "tagLength")]
fn tag_length_shim(this: &AesGcmParams, val: u8);
fn set_tag_length_shim(this: &AesGcmParams, val: u8);
}
#[doc = "The trait to access properties on the `AesGcmParams` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
pub trait AesGcmParamsGetters {
#[doc = "Get the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
fn name(&self) -> String;
#[doc = "Get the `additionalData` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
fn additional_data(&self) -> ::js_sys::Object;
#[doc = "Get the `iv` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
fn iv(&self) -> ::js_sys::Object;
#[doc = "Get the `tagLength` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
fn tag_length(&self) -> u8;
}
impl AesGcmParamsGetters for AesGcmParams {
fn name(&self) -> String {
self.name_shim()
}
fn additional_data(&self) -> ::js_sys::Object {
self.additional_data_shim()
}
fn iv(&self) -> ::js_sys::Object {
self.iv_shim()
}
fn tag_length(&self) -> u8 {
self.tag_length_shim()
}
}
impl AesGcmParams {
#[doc = "Construct a new `AesGcmParams`."]
Expand All @@ -26,36 +69,36 @@ 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);
Self::name(&mut ret, name);
Self::iv(&mut ret, iv);
ret
}
#[doc = "Change the `name` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"]
pub fn name(&mut self, val: &str) -> &mut Self {
self.name_shim(val);
self.set_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 {
self.additional_data_shim(val);
self.set_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 {
self.iv_shim(val);
self.set_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 {
self.tag_length_shim(val);
self.set_tag_length_shim(val);
self
}
}