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

Add dataview attribute output to WebIDL Codegen #2316

Merged
merged 2 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ CustomEventInit = []
DataTransfer = []
DataTransferItem = []
DataTransferItemList = []
DataView = []
DateTimeValue = []
DecoderDoctorNotification = []
DecoderDoctorNotificationType = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ extern "C" {
this: &BluetoothRemoteGattCharacteristic,
) -> BluetoothCharacteristicProperties;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "DataView")]
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTCharacteristic" , 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/BluetoothRemoteGATTCharacteristic/value)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattCharacteristic`, `DataView`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &BluetoothRemoteGattCharacteristic) -> Option<::js_sys::DataView>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = oncharacteristicvaluechanged)]
#[doc = "Getter for the `oncharacteristicvaluechanged` field of this object."]
#[doc = ""]
Expand Down
12 changes: 12 additions & 0 deletions crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 uuid(this: &BluetoothRemoteGattDescriptor) -> String;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "DataView")]
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTDescriptor" , 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/BluetoothRemoteGATTDescriptor/value)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattDescriptor`, `DataView`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &BluetoothRemoteGattDescriptor) -> Option<::js_sys::DataView>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = readValue)]
#[doc = "The `readValue()` method."]
#[doc = ""]
Expand Down
2 changes: 1 addition & 1 deletion crates/webidl/src/idl_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl<'a> IdlType<'a> {
IdlType::Error => Err(TypeError::CannotConvert),

IdlType::ArrayBuffer => Ok(js_sys("ArrayBuffer")),
IdlType::DataView => Err(TypeError::CannotConvert),
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 } => {
Expand Down