diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 7e3b8a82313..54ca3348a61 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -42,6 +42,7 @@ AesKeyGenParams = [] Algorithm = [] AlignSetting = [] AllowedBluetoothDevice = [] +AllowedUsbDevice = [] AnalyserNode = ["AudioNode", "EventTarget"] AnalyserOptions = [] AngleInstancedArrays = [] @@ -247,7 +248,6 @@ CustomEventInit = [] DataTransfer = [] DataTransferItem = [] DataTransferItemList = [] -DataView = [] DateTimeValue = [] DecoderDoctorNotification = [] DecoderDoctorNotificationType = [] @@ -1238,6 +1238,31 @@ UiEvent = ["Event"] UiEventInit = [] Url = [] UrlSearchParams = [] +Usb = ["EventTarget"] +UsbAlternateInterface = [] +UsbConfiguration = [] +UsbConnectionEvent = ["Event"] +UsbConnectionEventInit = [] +UsbControlTransferParameters = [] +UsbDevice = [] +UsbDeviceFilter = [] +UsbDeviceRequestOptions = [] +UsbDirection = [] +UsbEndpoint = [] +UsbEndpointType = [] +UsbInTransferResult = [] +UsbInterface = [] +UsbIsochronousInTransferPacket = [] +UsbIsochronousInTransferResult = [] +UsbIsochronousOutTransferPacket = [] +UsbIsochronousOutTransferResult = [] +UsbOutTransferResult = [] +UsbPermissionDescriptor = [] +UsbPermissionResult = ["EventTarget", "PermissionStatus"] +UsbPermissionStorage = [] +UsbRecipient = [] +UsbRequestType = [] +UsbTransferStatus = [] UserProximityEvent = ["Event"] UserProximityEventInit = [] UserVerificationRequirement = [] diff --git a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs new file mode 100644 index 00000000000..b4b082f13f8 --- /dev/null +++ b/crates/web-sys/src/features/gen_AllowedUsbDevice.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 = AllowedUSBDevice)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AllowedUsbDevice` dictionary."] + #[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)*"] + pub type AllowedUsbDevice; +} +#[cfg(web_sys_unstable_apis)] +impl AllowedUsbDevice { + #[doc = "Construct a new `AllowedUsbDevice`."] + #[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)*"] + 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs index 29a42f84b57..475304540ec 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.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 device(this: &BluetoothAdvertisingEvent) -> BluetoothDevice; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = uuids)] + #[doc = "Getter for the `uuids` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/uuids)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &BluetoothAdvertisingEvent) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = name)] #[doc = "Getter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionResult.rs b/crates/web-sys/src/features/gen_BluetoothPermissionResult.rs index a293879e24b..68bc1a244ae 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionResult.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionResult.rs @@ -15,4 +15,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 BluetoothPermissionResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "BluetoothPermissionResult" , js_name = devices)] + #[doc = "Getter for the `devices` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothPermissionResult/devices)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn devices(this: &BluetoothPermissionResult) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "BluetoothPermissionResult" , js_name = devices)] + #[doc = "Setter for the `devices` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothPermissionResult/devices)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_devices(this: &BluetoothPermissionResult, value: &::wasm_bindgen::JsValue); } diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs index eda7b431bcc..7858ac35a37 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs @@ -53,13 +53,12 @@ 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 = "*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)*"] diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs index 37cf39179e2..14375523a85 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs @@ -41,13 +41,12 @@ 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 = "*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)*"] diff --git a/crates/web-sys/src/features/gen_ClipboardItem.rs b/crates/web-sys/src/features/gen_ClipboardItem.rs index 0ef7719c61b..ba376129676 100644 --- a/crates/web-sys/src/features/gen_ClipboardItem.rs +++ b/crates/web-sys/src/features/gen_ClipboardItem.rs @@ -50,6 +50,17 @@ extern "C" { #[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 = ""] diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index aaf69c8bb7c..cc7775ecacd 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -27,6 +27,17 @@ extern "C" { #[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)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = extensions)] + #[doc = "Getter for the `extensions` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/extensions)"] + #[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 extensions(this: &GpuAdapter) -> ::js_sys::Array; + #[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_GpuCompilationInfo.rs b/crates/web-sys/src/features/gen_GpuCompilationInfo.rs index 47601d58006..02974b61563 100644 --- a/crates/web-sys/src/features/gen_GpuCompilationInfo.rs +++ b/crates/web-sys/src/features/gen_GpuCompilationInfo.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 GpuCompilationInfo; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUCompilationInfo" , js_name = messages)] + #[doc = "Getter for the `messages` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCompilationInfo/messages)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCompilationInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn messages(this: &GpuCompilationInfo) -> ::js_sys::Array; } diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 903458d386b..fd832b64693 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.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 adapter(this: &GpuDevice) -> GpuAdapter; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = extensions)] + #[doc = "Getter for the `extensions` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/extensions)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `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 extensions(this: &GpuDevice) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = limits)] #[doc = "Getter for the `limits` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 8ccb0ef4bcd..008f86c0942 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -141,6 +141,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn gpu(this: &Navigator) -> Gpu; #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/usb)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`, `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &Navigator) -> Usb; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Xr")] # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = xr)] #[doc = "Getter for the `xr` field of this object."] diff --git a/crates/web-sys/src/features/gen_Usb.rs b/crates/web-sys/src/features/gen_Usb.rs new file mode 100644 index 00000000000..3b10babdcbe --- /dev/null +++ b/crates/web-sys/src/features/gen_Usb.rs @@ -0,0 +1,85 @@ +#![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 = USB , typescript_type = "USB")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Usb` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USB)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Usb; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USB" , 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/USB/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &Usb) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "USB" , 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/USB/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &Usb, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USB" , 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/USB/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &Usb) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "USB" , 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/USB/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &Usb, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USB" , js_name = getDevices)] + #[doc = "The `getDevices()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USB/getDevices)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_devices(this: &Usb) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbDeviceRequestOptions")] + # [wasm_bindgen (method , structural , js_class = "USB" , js_name = requestDevice)] + #[doc = "The `requestDevice()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USB/requestDevice)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`, `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)*"] + pub fn request_device(this: &Usb, options: &UsbDeviceRequestOptions) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_UsbAlternateInterface.rs b/crates/web-sys/src/features/gen_UsbAlternateInterface.rs new file mode 100644 index 00000000000..e077ccc1f3e --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbAlternateInterface.rs @@ -0,0 +1,84 @@ +#![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 = USBAlternateInterface , typescript_type = "USBAlternateInterface")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbAlternateInterface` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbAlternateInterface; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = alternateSetting)] + #[doc = "Getter for the `alternateSetting` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/alternateSetting)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn alternate_setting(this: &UsbAlternateInterface) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = interfaceClass)] + #[doc = "Getter for the `interfaceClass` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/interfaceClass)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_class(this: &UsbAlternateInterface) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = interfaceSubclass)] + #[doc = "Getter for the `interfaceSubclass` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/interfaceSubclass)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_subclass(this: &UsbAlternateInterface) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = interfaceProtocol)] + #[doc = "Getter for the `interfaceProtocol` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/interfaceProtocol)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_protocol(this: &UsbAlternateInterface) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = interfaceName)] + #[doc = "Getter for the `interfaceName` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/interfaceName)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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; + #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface/endpoints)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn endpoints(this: &UsbAlternateInterface) -> ::js_sys::Array; +} diff --git a/crates/web-sys/src/features/gen_UsbConfiguration.rs b/crates/web-sys/src/features/gen_UsbConfiguration.rs new file mode 100644 index 00000000000..deaf5e59384 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbConfiguration.rs @@ -0,0 +1,51 @@ +#![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 = USBConfiguration , typescript_type = "USBConfiguration")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbConfiguration` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbConfiguration; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBConfiguration" , js_name = configurationValue)] + #[doc = "Getter for the `configurationValue` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration/configurationValue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_value(this: &UsbConfiguration) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBConfiguration" , js_name = configurationName)] + #[doc = "Getter for the `configurationName` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration/configurationName)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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; + #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration/interfaces)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn interfaces(this: &UsbConfiguration) -> ::js_sys::Array; +} diff --git a/crates/web-sys/src/features/gen_UsbConnectionEvent.rs b/crates/web-sys/src/features/gen_UsbConnectionEvent.rs new file mode 100644 index 00000000000..38e2cbb6beb --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbConnectionEvent.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 = Event , extends = :: js_sys :: Object , js_name = USBConnectionEvent , typescript_type = "USBConnectionEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbConnectionEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBConnectionEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbConnectionEvent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbDevice")] + # [wasm_bindgen (structural , method , getter , js_class = "USBConnectionEvent" , 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/USBConnectionEvent/device)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEvent`, `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 device(this: &UsbConnectionEvent) -> UsbDevice; +} diff --git a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs new file mode 100644 index 00000000000..d0ed6bf52b6 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbConnectionEventInit.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 = USBConnectionEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbConnectionEventInit` dictionary."] + #[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)*"] + pub type UsbConnectionEventInit; +} +#[cfg(web_sys_unstable_apis)] +impl UsbConnectionEventInit { + #[cfg(feature = "UsbDevice")] + #[doc = "Construct a new `UsbConnectionEventInit`."] + #[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)*"] + 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 + } + #[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)*"] + 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: `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)*"] + 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: `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)*"] + 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 = "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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs new file mode 100644 index 00000000000..51c820634c5 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbControlTransferParameters.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 = USBControlTransferParameters)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbControlTransferParameters` dictionary."] + #[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)*"] + pub type UsbControlTransferParameters; +} +#[cfg(web_sys_unstable_apis)] +impl UsbControlTransferParameters { + #[cfg(all(feature = "UsbRecipient", feature = "UsbRequestType",))] + #[doc = "Construct a new `UsbControlTransferParameters`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`, `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)*"] + pub fn new( + index: u16, + recipient: UsbRecipient, + request: u8, + request_type: UsbRequestType, + value: u16, + ) -> 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } + #[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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbDevice.rs b/crates/web-sys/src/features/gen_UsbDevice.rs new file mode 100644 index 00000000000..67806114dfb --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbDevice.rs @@ -0,0 +1,454 @@ +#![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 = USBDevice , typescript_type = "USBDevice")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbDevice` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice)"] + #[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 type UsbDevice; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = usbVersionMajor)] + #[doc = "Getter for the `usbVersionMajor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/usbVersionMajor)"] + #[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 usb_version_major(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = usbVersionMinor)] + #[doc = "Getter for the `usbVersionMinor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/usbVersionMinor)"] + #[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 usb_version_minor(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = usbVersionSubminor)] + #[doc = "Getter for the `usbVersionSubminor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/usbVersionSubminor)"] + #[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 usb_version_subminor(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceClass)] + #[doc = "Getter for the `deviceClass` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceClass)"] + #[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 device_class(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceSubclass)] + #[doc = "Getter for the `deviceSubclass` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceSubclass)"] + #[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 device_subclass(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceProtocol)] + #[doc = "Getter for the `deviceProtocol` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceProtocol)"] + #[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 device_protocol(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = vendorId)] + #[doc = "Getter for the `vendorId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/vendorId)"] + #[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 vendor_id(this: &UsbDevice) -> u16; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = productId)] + #[doc = "Getter for the `productId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/productId)"] + #[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 product_id(this: &UsbDevice) -> u16; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceVersionMajor)] + #[doc = "Getter for the `deviceVersionMajor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceVersionMajor)"] + #[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 device_version_major(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceVersionMinor)] + #[doc = "Getter for the `deviceVersionMinor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceVersionMinor)"] + #[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 device_version_minor(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = deviceVersionSubminor)] + #[doc = "Getter for the `deviceVersionSubminor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/deviceVersionSubminor)"] + #[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 device_version_subminor(this: &UsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = manufacturerName)] + #[doc = "Getter for the `manufacturerName` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/manufacturerName)"] + #[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 manufacturer_name(this: &UsbDevice) -> Option; + #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/productName)"] + #[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 product_name(this: &UsbDevice) -> Option; + #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/serialNumber)"] + #[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 serial_number(this: &UsbDevice) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbConfiguration")] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = configuration)] + #[doc = "Getter for the `configuration` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/configuration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConfiguration`, `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 configuration(this: &UsbDevice) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = configurations)] + #[doc = "Getter for the `configurations` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/configurations)"] + #[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 configurations(this: &UsbDevice) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = opened)] + #[doc = "Getter for the `opened` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/opened)"] + #[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 opened(this: &UsbDevice) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = claimInterface)] + #[doc = "The `claimInterface()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/claimInterface)"] + #[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 claim_interface(this: &UsbDevice, interface_number: u8) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbDirection")] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = clearHalt)] + #[doc = "The `clearHalt()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/clearHalt)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDevice`, `UsbDirection`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_halt( + this: &UsbDevice, + direction: UsbDirection, + endpoint_number: u8, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = close)] + #[doc = "The `close()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/close)"] + #[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 close(this: &UsbDevice) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbControlTransferParameters")] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = controlTransferIn)] + #[doc = "The `controlTransferIn()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/controlTransferIn)"] + #[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_in( + this: &UsbDevice, + setup: &UsbControlTransferParameters, + length: u16, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbControlTransferParameters")] + # [wasm_bindgen (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( + this: &UsbDevice, + setup: &UsbControlTransferParameters, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbControlTransferParameters")] + # [wasm_bindgen (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_buffer_source( + this: &UsbDevice, + setup: &UsbControlTransferParameters, + data: &::js_sys::Object, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbControlTransferParameters")] + # [wasm_bindgen (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: &mut [u8], + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = isochronousTransferIn)] + #[doc = "The `isochronousTransferIn()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/isochronousTransferIn)"] + #[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_in( + this: &UsbDevice, + endpoint_number: u8, + packet_lengths: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (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_buffer_source( + this: &UsbDevice, + endpoint_number: u8, + data: &::js_sys::Object, + packet_lengths: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (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: &mut [u8], + packet_lengths: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = open)] + #[doc = "The `open()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/open)"] + #[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 open(this: &UsbDevice) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = releaseInterface)] + #[doc = "The `releaseInterface()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/releaseInterface)"] + #[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 release_interface(this: &UsbDevice, interface_number: u8) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/reset)"] + #[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 reset(this: &UsbDevice) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = selectAlternateInterface)] + #[doc = "The `selectAlternateInterface()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/selectAlternateInterface)"] + #[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 select_alternate_interface( + this: &UsbDevice, + interface_number: u8, + alternate_setting: u8, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = selectConfiguration)] + #[doc = "The `selectConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/selectConfiguration)"] + #[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 select_configuration(this: &UsbDevice, configuration_value: u8) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = transferIn)] + #[doc = "The `transferIn()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/transferIn)"] + #[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_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)] + #[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_buffer_source( + this: &UsbDevice, + endpoint_number: u8, + data: &::js_sys::Object, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (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: &mut [u8], + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs new file mode 100644 index 00000000000..46523e37483 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbDeviceFilter.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 = USBDeviceFilter)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbDeviceFilter` dictionary."] + #[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 type UsbDeviceFilter; +} +#[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)] + #[doc = "Change 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 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 + } + #[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: `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 { + 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 + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change 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)*"] + 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 + } + #[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: `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 { + 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 + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change 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)*"] + 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 + } + #[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: `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 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs new file mode 100644 index 00000000000..10f3f70e496 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs @@ -0,0 +1,52 @@ +#![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 = USBDeviceRequestOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbDeviceRequestOptions` dictionary."] + #[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)*"] + pub type UsbDeviceRequestOptions; +} +#[cfg(web_sys_unstable_apis)] +impl UsbDeviceRequestOptions { + #[doc = "Construct a new `UsbDeviceRequestOptions`."] + #[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)*"] + 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 + } + #[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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbDirection.rs b/crates/web-sys/src/features/gen_UsbDirection.rs new file mode 100644 index 00000000000..93583f25888 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbDirection.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `UsbDirection` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `UsbDirection`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_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 UsbDirection { + In = "in", + Out = "out", +} diff --git a/crates/web-sys/src/features/gen_UsbEndpoint.rs b/crates/web-sys/src/features/gen_UsbEndpoint.rs new file mode 100644 index 00000000000..57e244c7f12 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbEndpoint.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 = :: js_sys :: Object , js_name = USBEndpoint , typescript_type = "USBEndpoint")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbEndpoint` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbEndpoint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbEndpoint; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBEndpoint" , js_name = endpointNumber)] + #[doc = "Getter for the `endpointNumber` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint/endpointNumber)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbEndpoint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn endpoint_number(this: &UsbEndpoint) -> u8; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbDirection")] + # [wasm_bindgen (structural , method , getter , js_class = "USBEndpoint" , js_name = direction)] + #[doc = "Getter for the `direction` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint/direction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDirection`, `UsbEndpoint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &UsbEndpoint) -> UsbDirection; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbEndpointType")] + # [wasm_bindgen (structural , method , getter , js_class = "USBEndpoint" , 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/USBEndpoint/type)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbEndpoint`, `UsbEndpointType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &UsbEndpoint) -> UsbEndpointType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBEndpoint" , js_name = packetSize)] + #[doc = "Getter for the `packetSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint/packetSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbEndpoint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn packet_size(this: &UsbEndpoint) -> u32; +} diff --git a/crates/web-sys/src/features/gen_UsbEndpointType.rs b/crates/web-sys/src/features/gen_UsbEndpointType.rs new file mode 100644 index 00000000000..26c5fa8bcb0 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbEndpointType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `UsbEndpointType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `UsbEndpointType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_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 UsbEndpointType { + Bulk = "bulk", + Interrupt = "interrupt", + Isochronous = "isochronous", +} diff --git a/crates/web-sys/src/features/gen_UsbInTransferResult.rs b/crates/web-sys/src/features/gen_UsbInTransferResult.rs new file mode 100644 index 00000000000..ef0af45772a --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbInTransferResult.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 = USBInTransferResult , typescript_type = "USBInTransferResult")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbInTransferResult` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInTransferResult)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbInTransferResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBInTransferResult" , 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/USBInTransferResult/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &UsbInTransferResult) -> Option<::js_sys::DataView>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbTransferStatus")] + # [wasm_bindgen (structural , method , getter , js_class = "USBInTransferResult" , js_name = status)] + #[doc = "Getter for the `status` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInTransferResult/status)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInTransferResult`, `UsbTransferStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn status(this: &UsbInTransferResult) -> UsbTransferStatus; +} diff --git a/crates/web-sys/src/features/gen_UsbInterface.rs b/crates/web-sys/src/features/gen_UsbInterface.rs new file mode 100644 index 00000000000..27320d46ff3 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbInterface.rs @@ -0,0 +1,63 @@ +#![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 = USBInterface , typescript_type = "USBInterface")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbInterface` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbInterface; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBInterface" , js_name = interfaceNumber)] + #[doc = "Getter for the `interfaceNumber` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface/interfaceNumber)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_number(this: &UsbInterface) -> u8; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbAlternateInterface")] + # [wasm_bindgen (structural , method , getter , js_class = "USBInterface" , js_name = alternate)] + #[doc = "Getter for the `alternate` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface/alternate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbAlternateInterface`, `UsbInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn alternate(this: &UsbInterface) -> UsbAlternateInterface; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBInterface" , js_name = alternates)] + #[doc = "Getter for the `alternates` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface/alternates)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn alternates(this: &UsbInterface) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBInterface" , js_name = claimed)] + #[doc = "Getter for the `claimed` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface/claimed)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbInterface`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn claimed(this: &UsbInterface) -> bool; +} diff --git a/crates/web-sys/src/features/gen_UsbIsochronousInTransferPacket.rs b/crates/web-sys/src/features/gen_UsbIsochronousInTransferPacket.rs new file mode 100644 index 00000000000..ec34c56b755 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbIsochronousInTransferPacket.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 = USBIsochronousInTransferPacket , typescript_type = "USBIsochronousInTransferPacket")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbIsochronousInTransferPacket` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousInTransferPacket)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferPacket`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbIsochronousInTransferPacket; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousInTransferPacket" , 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/USBIsochronousInTransferPacket/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferPacket`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &UsbIsochronousInTransferPacket) -> Option<::js_sys::DataView>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbTransferStatus")] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousInTransferPacket" , js_name = status)] + #[doc = "Getter for the `status` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousInTransferPacket/status)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferPacket`, `UsbTransferStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn status(this: &UsbIsochronousInTransferPacket) -> UsbTransferStatus; +} diff --git a/crates/web-sys/src/features/gen_UsbIsochronousInTransferResult.rs b/crates/web-sys/src/features/gen_UsbIsochronousInTransferResult.rs new file mode 100644 index 00000000000..96b54b527d3 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbIsochronousInTransferResult.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 = :: js_sys :: Object , js_name = USBIsochronousInTransferResult , typescript_type = "USBIsochronousInTransferResult")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbIsochronousInTransferResult` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousInTransferResult)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbIsochronousInTransferResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousInTransferResult" , 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/USBIsochronousInTransferResult/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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: &UsbIsochronousInTransferResult) -> Option<::js_sys::DataView>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousInTransferResult" , js_name = packets)] + #[doc = "Getter for the `packets` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousInTransferResult/packets)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousInTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &UsbIsochronousInTransferResult) -> ::js_sys::Array; +} diff --git a/crates/web-sys/src/features/gen_UsbIsochronousOutTransferPacket.rs b/crates/web-sys/src/features/gen_UsbIsochronousOutTransferPacket.rs new file mode 100644 index 00000000000..bbb83c7fd2b --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbIsochronousOutTransferPacket.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 = USBIsochronousOutTransferPacket , typescript_type = "USBIsochronousOutTransferPacket")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbIsochronousOutTransferPacket` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousOutTransferPacket)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousOutTransferPacket`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbIsochronousOutTransferPacket; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousOutTransferPacket" , js_name = bytesWritten)] + #[doc = "Getter for the `bytesWritten` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousOutTransferPacket/bytesWritten)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousOutTransferPacket`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &UsbIsochronousOutTransferPacket) -> u32; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbTransferStatus")] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousOutTransferPacket" , js_name = status)] + #[doc = "Getter for the `status` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousOutTransferPacket/status)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousOutTransferPacket`, `UsbTransferStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn status(this: &UsbIsochronousOutTransferPacket) -> UsbTransferStatus; +} diff --git a/crates/web-sys/src/features/gen_UsbIsochronousOutTransferResult.rs b/crates/web-sys/src/features/gen_UsbIsochronousOutTransferResult.rs new file mode 100644 index 00000000000..79ad6e0c64d --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbIsochronousOutTransferResult.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 = :: js_sys :: Object , js_name = USBIsochronousOutTransferResult , typescript_type = "USBIsochronousOutTransferResult")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbIsochronousOutTransferResult` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousOutTransferResult)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousOutTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbIsochronousOutTransferResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBIsochronousOutTransferResult" , js_name = packets)] + #[doc = "Getter for the `packets` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBIsochronousOutTransferResult/packets)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbIsochronousOutTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &UsbIsochronousOutTransferResult) -> ::js_sys::Array; +} diff --git a/crates/web-sys/src/features/gen_UsbOutTransferResult.rs b/crates/web-sys/src/features/gen_UsbOutTransferResult.rs new file mode 100644 index 00000000000..44dab6edf34 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbOutTransferResult.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 = USBOutTransferResult , typescript_type = "USBOutTransferResult")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbOutTransferResult` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBOutTransferResult)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbOutTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbOutTransferResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBOutTransferResult" , js_name = bytesWritten)] + #[doc = "Getter for the `bytesWritten` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBOutTransferResult/bytesWritten)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbOutTransferResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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(this: &UsbOutTransferResult) -> u32; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbTransferStatus")] + # [wasm_bindgen (structural , method , getter , js_class = "USBOutTransferResult" , js_name = status)] + #[doc = "Getter for the `status` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBOutTransferResult/status)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbOutTransferResult`, `UsbTransferStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn status(this: &UsbOutTransferResult) -> UsbTransferStatus; +} diff --git a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs new file mode 100644 index 00000000000..1d2341838f8 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.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 = USBPermissionDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbPermissionDescriptor` dictionary."] + #[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)*"] + pub type UsbPermissionDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl UsbPermissionDescriptor { + #[cfg(feature = "PermissionName")] + #[doc = "Construct a new `UsbPermissionDescriptor`."] + #[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)*"] + 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`, `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)*"] + 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)] + #[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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbPermissionResult.rs b/crates/web-sys/src/features/gen_UsbPermissionResult.rs new file mode 100644 index 00000000000..2dc7d854b4a --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbPermissionResult.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 = USBPermissionResult , typescript_type = "USBPermissionResult")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbPermissionResult` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBPermissionResult)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UsbPermissionResult; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "USBPermissionResult" , js_name = devices)] + #[doc = "Getter for the `devices` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBPermissionResult/devices)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn devices(this: &UsbPermissionResult) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "USBPermissionResult" , js_name = devices)] + #[doc = "Setter for the `devices` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBPermissionResult/devices)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to 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_devices(this: &UsbPermissionResult, value: &::wasm_bindgen::JsValue); +} diff --git a/crates/web-sys/src/features/gen_UsbPermissionStorage.rs b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs new file mode 100644 index 00000000000..dd89e67912c --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs @@ -0,0 +1,51 @@ +#![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 = USBPermissionStorage)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UsbPermissionStorage` dictionary."] + #[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)*"] + pub type UsbPermissionStorage; +} +#[cfg(web_sys_unstable_apis)] +impl UsbPermissionStorage { + #[doc = "Construct a new `UsbPermissionStorage`."] + #[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)*"] + 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 `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)*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_UsbRecipient.rs b/crates/web-sys/src/features/gen_UsbRecipient.rs new file mode 100644 index 00000000000..413c2f04d0a --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbRecipient.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `UsbRecipient` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `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)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum UsbRecipient { + Device = "device", + Interface = "interface", + Endpoint = "endpoint", + Other = "other", +} diff --git a/crates/web-sys/src/features/gen_UsbRequestType.rs b/crates/web-sys/src/features/gen_UsbRequestType.rs new file mode 100644 index 00000000000..a3984a59939 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbRequestType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `UsbRequestType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `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)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum UsbRequestType { + Standard = "standard", + Class = "class", + Vendor = "vendor", +} diff --git a/crates/web-sys/src/features/gen_UsbTransferStatus.rs b/crates/web-sys/src/features/gen_UsbTransferStatus.rs new file mode 100644 index 00000000000..2f80dee8418 --- /dev/null +++ b/crates/web-sys/src/features/gen_UsbTransferStatus.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `UsbTransferStatus` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `UsbTransferStatus`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_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 UsbTransferStatus { + Ok = "ok", + Stall = "stall", + Babble = "babble", +} diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index 4ef88c7fd20..1acef2dcf35 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -39,6 +39,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 gpu(this: &WorkerNavigator) -> Gpu; + #[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."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/usb)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Usb`, `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 usb(this: &WorkerNavigator) -> Usb; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = hardwareConcurrency)] #[doc = "Getter for the `hardwareConcurrency` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index b0f134104ff..732473b0dd2 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -70,6 +70,12 @@ mod gen_AllowedBluetoothDevice; #[cfg(feature = "AllowedBluetoothDevice")] pub use gen_AllowedBluetoothDevice::*; +#[cfg(feature = "AllowedUsbDevice")] +#[allow(non_snake_case)] +mod gen_AllowedUsbDevice; +#[cfg(feature = "AllowedUsbDevice")] +pub use gen_AllowedUsbDevice::*; + #[cfg(feature = "AnalyserNode")] #[allow(non_snake_case)] mod gen_AnalyserNode; @@ -7240,6 +7246,156 @@ mod gen_UrlSearchParams; #[cfg(feature = "UrlSearchParams")] pub use gen_UrlSearchParams::*; +#[cfg(feature = "Usb")] +#[allow(non_snake_case)] +mod gen_Usb; +#[cfg(feature = "Usb")] +pub use gen_Usb::*; + +#[cfg(feature = "UsbAlternateInterface")] +#[allow(non_snake_case)] +mod gen_UsbAlternateInterface; +#[cfg(feature = "UsbAlternateInterface")] +pub use gen_UsbAlternateInterface::*; + +#[cfg(feature = "UsbConfiguration")] +#[allow(non_snake_case)] +mod gen_UsbConfiguration; +#[cfg(feature = "UsbConfiguration")] +pub use gen_UsbConfiguration::*; + +#[cfg(feature = "UsbConnectionEvent")] +#[allow(non_snake_case)] +mod gen_UsbConnectionEvent; +#[cfg(feature = "UsbConnectionEvent")] +pub use gen_UsbConnectionEvent::*; + +#[cfg(feature = "UsbConnectionEventInit")] +#[allow(non_snake_case)] +mod gen_UsbConnectionEventInit; +#[cfg(feature = "UsbConnectionEventInit")] +pub use gen_UsbConnectionEventInit::*; + +#[cfg(feature = "UsbControlTransferParameters")] +#[allow(non_snake_case)] +mod gen_UsbControlTransferParameters; +#[cfg(feature = "UsbControlTransferParameters")] +pub use gen_UsbControlTransferParameters::*; + +#[cfg(feature = "UsbDevice")] +#[allow(non_snake_case)] +mod gen_UsbDevice; +#[cfg(feature = "UsbDevice")] +pub use gen_UsbDevice::*; + +#[cfg(feature = "UsbDeviceFilter")] +#[allow(non_snake_case)] +mod gen_UsbDeviceFilter; +#[cfg(feature = "UsbDeviceFilter")] +pub use gen_UsbDeviceFilter::*; + +#[cfg(feature = "UsbDeviceRequestOptions")] +#[allow(non_snake_case)] +mod gen_UsbDeviceRequestOptions; +#[cfg(feature = "UsbDeviceRequestOptions")] +pub use gen_UsbDeviceRequestOptions::*; + +#[cfg(feature = "UsbDirection")] +#[allow(non_snake_case)] +mod gen_UsbDirection; +#[cfg(feature = "UsbDirection")] +pub use gen_UsbDirection::*; + +#[cfg(feature = "UsbEndpoint")] +#[allow(non_snake_case)] +mod gen_UsbEndpoint; +#[cfg(feature = "UsbEndpoint")] +pub use gen_UsbEndpoint::*; + +#[cfg(feature = "UsbEndpointType")] +#[allow(non_snake_case)] +mod gen_UsbEndpointType; +#[cfg(feature = "UsbEndpointType")] +pub use gen_UsbEndpointType::*; + +#[cfg(feature = "UsbInTransferResult")] +#[allow(non_snake_case)] +mod gen_UsbInTransferResult; +#[cfg(feature = "UsbInTransferResult")] +pub use gen_UsbInTransferResult::*; + +#[cfg(feature = "UsbInterface")] +#[allow(non_snake_case)] +mod gen_UsbInterface; +#[cfg(feature = "UsbInterface")] +pub use gen_UsbInterface::*; + +#[cfg(feature = "UsbIsochronousInTransferPacket")] +#[allow(non_snake_case)] +mod gen_UsbIsochronousInTransferPacket; +#[cfg(feature = "UsbIsochronousInTransferPacket")] +pub use gen_UsbIsochronousInTransferPacket::*; + +#[cfg(feature = "UsbIsochronousInTransferResult")] +#[allow(non_snake_case)] +mod gen_UsbIsochronousInTransferResult; +#[cfg(feature = "UsbIsochronousInTransferResult")] +pub use gen_UsbIsochronousInTransferResult::*; + +#[cfg(feature = "UsbIsochronousOutTransferPacket")] +#[allow(non_snake_case)] +mod gen_UsbIsochronousOutTransferPacket; +#[cfg(feature = "UsbIsochronousOutTransferPacket")] +pub use gen_UsbIsochronousOutTransferPacket::*; + +#[cfg(feature = "UsbIsochronousOutTransferResult")] +#[allow(non_snake_case)] +mod gen_UsbIsochronousOutTransferResult; +#[cfg(feature = "UsbIsochronousOutTransferResult")] +pub use gen_UsbIsochronousOutTransferResult::*; + +#[cfg(feature = "UsbOutTransferResult")] +#[allow(non_snake_case)] +mod gen_UsbOutTransferResult; +#[cfg(feature = "UsbOutTransferResult")] +pub use gen_UsbOutTransferResult::*; + +#[cfg(feature = "UsbPermissionDescriptor")] +#[allow(non_snake_case)] +mod gen_UsbPermissionDescriptor; +#[cfg(feature = "UsbPermissionDescriptor")] +pub use gen_UsbPermissionDescriptor::*; + +#[cfg(feature = "UsbPermissionResult")] +#[allow(non_snake_case)] +mod gen_UsbPermissionResult; +#[cfg(feature = "UsbPermissionResult")] +pub use gen_UsbPermissionResult::*; + +#[cfg(feature = "UsbPermissionStorage")] +#[allow(non_snake_case)] +mod gen_UsbPermissionStorage; +#[cfg(feature = "UsbPermissionStorage")] +pub use gen_UsbPermissionStorage::*; + +#[cfg(feature = "UsbRecipient")] +#[allow(non_snake_case)] +mod gen_UsbRecipient; +#[cfg(feature = "UsbRecipient")] +pub use gen_UsbRecipient::*; + +#[cfg(feature = "UsbRequestType")] +#[allow(non_snake_case)] +mod gen_UsbRequestType; +#[cfg(feature = "UsbRequestType")] +pub use gen_UsbRequestType::*; + +#[cfg(feature = "UsbTransferStatus")] +#[allow(non_snake_case)] +mod gen_UsbTransferStatus; +#[cfg(feature = "UsbTransferStatus")] +pub use gen_UsbTransferStatus::*; + #[cfg(feature = "UserProximityEvent")] #[allow(non_snake_case)] mod gen_UserProximityEvent; diff --git a/crates/web-sys/webidls/unstable/WebUSB.webidl b/crates/web-sys/webidls/unstable/WebUSB.webidl new file mode 100644 index 00000000000..17b9676fc1a --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebUSB.webidl @@ -0,0 +1,243 @@ +dictionary USBDeviceFilter { + unsigned short vendorId; + unsigned short productId; + octet classCode; + octet subclassCode; + octet protocolCode; + DOMString serialNumber; +}; + +dictionary USBDeviceRequestOptions { + required sequence filters; +}; + +[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext] +interface USB : EventTarget { + attribute EventHandler onconnect; + attribute EventHandler ondisconnect; + Promise> getDevices(); + [Exposed=Window] Promise requestDevice(USBDeviceRequestOptions options); +}; + +[Exposed=Window, SecureContext] +partial interface Navigator { + [SameObject] readonly attribute USB usb; +}; + +[Exposed=(DedicatedWorker,SharedWorker), SecureContext] +partial interface WorkerNavigator { + [SameObject] readonly attribute USB usb; +}; + +dictionary USBConnectionEventInit : EventInit { + required USBDevice device; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBConnectionEvent : Event { + constructor(DOMString type, USBConnectionEventInit eventInitDict); + [SameObject] readonly attribute USBDevice device; +}; + +[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext] +interface USBDevice { + readonly attribute octet usbVersionMajor; + readonly attribute octet usbVersionMinor; + readonly attribute octet usbVersionSubminor; + readonly attribute octet deviceClass; + readonly attribute octet deviceSubclass; + readonly attribute octet deviceProtocol; + readonly attribute unsigned short vendorId; + readonly attribute unsigned short productId; + readonly attribute octet deviceVersionMajor; + readonly attribute octet deviceVersionMinor; + readonly attribute octet deviceVersionSubminor; + readonly attribute DOMString? manufacturerName; + readonly attribute DOMString? productName; + readonly attribute DOMString? serialNumber; + readonly attribute USBConfiguration? configuration; + readonly attribute FrozenArray configurations; + readonly attribute boolean opened; + Promise open(); + Promise close(); + Promise selectConfiguration(octet configurationValue); + Promise claimInterface(octet interfaceNumber); + Promise releaseInterface(octet interfaceNumber); + Promise selectAlternateInterface(octet interfaceNumber, octet alternateSetting); + Promise controlTransferIn(USBControlTransferParameters setup, unsigned short length); + Promise controlTransferOut(USBControlTransferParameters setup, optional BufferSource data); + Promise clearHalt(USBDirection direction, octet endpointNumber); + Promise transferIn(octet endpointNumber, unsigned long length); + Promise transferOut(octet endpointNumber, BufferSource data); + Promise isochronousTransferIn(octet endpointNumber, sequence packetLengths); + Promise isochronousTransferOut(octet endpointNumber, BufferSource data, sequence packetLengths); + Promise reset(); +}; + +enum USBRequestType { + "standard", + "class", + "vendor" +}; + +enum USBRecipient { + "device", + "interface", + "endpoint", + "other" +}; + +enum USBTransferStatus { + "ok", + "stall", + "babble" +}; + +dictionary USBControlTransferParameters { + required USBRequestType requestType; + required USBRecipient recipient; + required octet request; + required unsigned short value; + required unsigned short index; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBInTransferResult { + constructor(USBTransferStatus status, optional DataView? data); + readonly attribute DataView? data; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBOutTransferResult { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); + readonly attribute unsigned long bytesWritten; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousInTransferPacket { + constructor(USBTransferStatus status, optional DataView? data); + readonly attribute DataView? data; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousInTransferResult { + constructor(sequence packets, optional DataView? data); + readonly attribute DataView? data; + readonly attribute FrozenArray packets; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousOutTransferPacket { + constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0); + readonly attribute unsigned long bytesWritten; + readonly attribute USBTransferStatus status; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBIsochronousOutTransferResult { + constructor(sequence packets); + readonly attribute FrozenArray packets; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBConfiguration { + constructor(USBDevice device, octet configurationValue); + readonly attribute octet configurationValue; + readonly attribute DOMString? configurationName; + readonly attribute FrozenArray interfaces; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBInterface { + constructor(USBConfiguration configuration, octet interfaceNumber); + readonly attribute octet interfaceNumber; + readonly attribute USBAlternateInterface alternate; + readonly attribute FrozenArray alternates; + readonly attribute boolean claimed; +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBAlternateInterface { + constructor(USBInterface deviceInterface, octet alternateSetting); + readonly attribute octet alternateSetting; + readonly attribute octet interfaceClass; + readonly attribute octet interfaceSubclass; + readonly attribute octet interfaceProtocol; + readonly attribute DOMString? interfaceName; + readonly attribute FrozenArray endpoints; +}; + +enum USBDirection { + "in", + "out" +}; + +enum USBEndpointType { + "bulk", + "interrupt", + "isochronous" +}; + +[ + Exposed=(DedicatedWorker,SharedWorker,Window), + SecureContext +] +interface USBEndpoint { + constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction); + readonly attribute octet endpointNumber; + readonly attribute USBDirection direction; + readonly attribute USBEndpointType type; + readonly attribute unsigned long packetSize; +}; + +dictionary USBPermissionDescriptor : PermissionDescriptor { + sequence filters; +}; + +dictionary AllowedUSBDevice { + required octet vendorId; + required octet productId; + DOMString serialNumber; +}; + +dictionary USBPermissionStorage { + sequence allowedDevices = []; +}; + +[Exposed=(DedicatedWorker,SharedWorker,Window)] +interface USBPermissionResult : PermissionStatus { + attribute FrozenArray devices; +}; \ No newline at end of file diff --git a/crates/webidl-tests/Cargo.toml b/crates/webidl-tests/Cargo.toml index 90eebca8358..c16223adc97 100644 --- a/crates/webidl-tests/Cargo.toml +++ b/crates/webidl-tests/Cargo.toml @@ -12,6 +12,7 @@ path = 'lib.rs' [dependencies] js-sys = { path = '../js-sys' } +wasm-bindgen-futures = { path = '../futures' } wasm-bindgen = { path = '../..' } [build-dependencies] diff --git a/crates/webidl-tests/array.rs b/crates/webidl-tests/array.rs index a9813219e45..58730001bad 100644 --- a/crates/webidl-tests/array.rs +++ b/crates/webidl-tests/array.rs @@ -17,4 +17,18 @@ fn take_and_return_a_bunch_of_slices() { 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.octet_array() + .iter() + .map(|v| v.as_f64().unwrap()) + .collect::>(), + [3., 4., 5.] + ); + assert_eq!( + f.octet_sequence() + .iter() + .map(|v| v.as_f64().unwrap()) + .collect::>(), + [3., 4., 5.] + ); } diff --git a/crates/webidl-tests/array_buffer.rs b/crates/webidl-tests/array_buffer.rs index 53cc9eb8c90..bd8974e0c3b 100644 --- a/crates/webidl-tests/array_buffer.rs +++ b/crates/webidl-tests/array_buffer.rs @@ -7,4 +7,6 @@ fn take_and_return_a_bunch_of_slices() { let x = f.get_buffer(); f.set_buffer(None); f.set_buffer(Some(&x)); + let buf = f.get_data_view(); + assert_eq!(buf.get_int8(0), 42); } diff --git a/crates/webidl-tests/globals.js b/crates/webidl-tests/globals.js index 4404ea088a5..00a45ecf6f2 100644 --- a/crates/webidl-tests/globals.js +++ b/crates/webidl-tests/globals.js @@ -69,6 +69,13 @@ global.TestArrays = class { strictEqual(x[1], 2); return new Uint32Array([3, 4, 5]); } + get octetArray() { + return new Uint8Array([3, 4, 5]); + } + + get octetSequence() { + return new Uint8Array([3, 4, 5]); + } }; global.ArrayBufferTest = class { @@ -78,6 +85,15 @@ global.ArrayBufferTest = class { setBuffer(x) { // ... } + getDataView() { + // taken from MDN + const buffer = new ArrayBuffer(16); + const view1 = new DataView(buffer); + const view2 = new DataView(buffer, 12, 4); + view1.setInt8(12, 42); + + return view2; + } }; global.TakeCallbackInterface = class { @@ -149,13 +165,13 @@ const map = { global.get_global = () => map; global.math_test = { - pow(base, exp) { - return Math.pow(base, exp); - }, + pow(base, exp) { + return Math.pow(base, exp); + }, - add_one(val) { - return val + 1; - }, + add_one(val) { + return val + 1; + }, }; global.GetNoInterfaceObject = class { @@ -384,3 +400,9 @@ global.GetUnstableInterface = class { } } } + +global.TestPromises = class { + stringPromise() { + return new Promise(r => r("abc")); + } +}; diff --git a/crates/webidl-tests/main.rs b/crates/webidl-tests/main.rs index 1a9d35586cc..c9fc9ebc47a 100644 --- a/crates/webidl-tests/main.rs +++ b/crates/webidl-tests/main.rs @@ -28,6 +28,7 @@ pub mod enums; pub mod global; pub mod namespace; pub mod no_interface; +pub mod promise; pub mod simple; pub mod throws; pub mod unstable; diff --git a/crates/webidl-tests/promise.rs b/crates/webidl-tests/promise.rs new file mode 100644 index 00000000000..5854529927b --- /dev/null +++ b/crates/webidl-tests/promise.rs @@ -0,0 +1,14 @@ +use crate::generated::*; +use wasm_bindgen_futures::JsFuture; +use wasm_bindgen_test::*; + +#[wasm_bindgen_test] +async fn return_promise() { + let f = TestPromises::new().unwrap(); + let v = JsFuture::from(f.string_promise()) + .await + .unwrap() + .as_string() + .unwrap(); + assert_eq!(v, "abc"); +} diff --git a/crates/webidl-tests/webidls/enabled/array.webidl b/crates/webidl-tests/webidls/enabled/array.webidl index 9830ad8899a..bbebf010c22 100644 --- a/crates/webidl-tests/webidls/enabled/array.webidl +++ b/crates/webidl-tests/webidls/enabled/array.webidl @@ -13,4 +13,7 @@ interface TestArrays { Uint8ClampedArray u8Clamped(Uint8ClampedArray a); Uint16Array u16(Uint16Array a); Uint32Array u32(Uint32Array a); + + readonly attribute FrozenArray octetArray; + readonly attribute sequence octetSequence; }; diff --git a/crates/webidl-tests/webidls/enabled/array_buffer.webidl b/crates/webidl-tests/webidls/enabled/array_buffer.webidl index d3f7b24b6c4..0292fa20989 100644 --- a/crates/webidl-tests/webidls/enabled/array_buffer.webidl +++ b/crates/webidl-tests/webidls/enabled/array_buffer.webidl @@ -2,4 +2,5 @@ interface ArrayBufferTest { ArrayBuffer getBuffer(); void setBuffer(ArrayBuffer? b); + DataView getDataView(); }; diff --git a/crates/webidl-tests/webidls/enabled/promise.webidl b/crates/webidl-tests/webidls/enabled/promise.webidl new file mode 100644 index 00000000000..586e8168a27 --- /dev/null +++ b/crates/webidl-tests/webidls/enabled/promise.webidl @@ -0,0 +1,4 @@ +[Constructor()] +interface TestPromises { + Promise stringPromise(); +}; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index a06daa8758b..d11b4ac724b 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -30,6 +30,7 @@ lazy_static! { "Promise", "Function", "Clamped", + "DataView", ]); diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 83bec4fc4aa..df14f2400e7 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -598,10 +598,10 @@ impl<'a> IdlType<'a> { None => Ok(None), } } - IdlType::FrozenArray(_idl_type) => Err(TypeError::CannotConvert), // webidl sequences must always be returned as javascript `Array`s. They may accept // anything implementing the @@iterable interface. - IdlType::Sequence(_idl_type) => match pos { + // The same implementation is fine for `FrozenArray` + IdlType::FrozenArray(_idl_type) | IdlType::Sequence(_idl_type) => match pos { TypePosition::Argument => Ok(js_value), TypePosition::Return => Ok(js_sys("Array")), },