Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add WebIDL definitions for InputDeviceInfo and MediaTrackCapabilities #3935

Merged
merged 3 commits into from May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/web-sys/Cargo.toml
Expand Up @@ -326,6 +326,7 @@ DomStringList = []
DomStringMap = []
DomTokenList = []
DomWindowResizeEventDetail = []
DoubleRange = []
DragEvent = ["Event", "MouseEvent", "UiEvent"]
DragEventInit = []
DynamicsCompressorNode = ["AudioNode", "EventTarget"]
Expand Down Expand Up @@ -728,6 +729,7 @@ ImageEncodeOptions = []
ImageOrientation = []
ImageTrack = ["EventTarget"]
ImageTrackList = []
InputDeviceInfo = ["MediaDeviceInfo"]
InputEvent = ["Event", "UiEvent"]
InputEventInit = []
IntersectionObserver = []
Expand Down Expand Up @@ -829,6 +831,7 @@ MediaStreamTrackGeneratorInit = []
MediaStreamTrackProcessor = []
MediaStreamTrackProcessorInit = []
MediaStreamTrackState = []
MediaTrackCapabilities = []
MediaTrackConstraintSet = []
MediaTrackConstraints = []
MediaTrackSettings = []
Expand Down Expand Up @@ -1405,6 +1408,7 @@ TreeView = []
TreeWalker = []
U2f = []
U2fClientData = []
ULongRange = []
UdpMessageEventInit = []
UdpOptions = []
UiEvent = ["Event"]
Expand Down
63 changes: 63 additions & 0 deletions crates/web-sys/src/features/gen_DoubleRange.rs
@@ -0,0 +1,63 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = DoubleRange)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `DoubleRange` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"]
#[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 DoubleRange;
#[wasm_bindgen(method, setter = "max")]
fn max_shim(this: &DoubleRange, val: f64);
#[wasm_bindgen(method, setter = "min")]
fn min_shim(this: &DoubleRange, val: f64);
}
#[cfg(web_sys_unstable_apis)]
impl DoubleRange {
#[doc = "Construct a new `DoubleRange`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"]
#[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 `max` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"]
#[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 max(&mut self, val: f64) -> &mut Self {
self.max_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `min` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"]
#[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 min(&mut self, val: f64) -> &mut Self {
self.min_shim(val);
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for DoubleRange {
fn default() -> Self {
Self::new()
}
}
31 changes: 31 additions & 0 deletions crates/web-sys/src/features/gen_InputDeviceInfo.rs
@@ -0,0 +1,31 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = MediaDeviceInfo , extends = :: js_sys :: Object , js_name = InputDeviceInfo , typescript_type = "InputDeviceInfo")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `InputDeviceInfo` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `InputDeviceInfo`*"]
#[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 InputDeviceInfo;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "MediaTrackCapabilities")]
# [wasm_bindgen (method , structural , js_class = "InputDeviceInfo" , js_name = getCapabilities)]
#[doc = "The `getCapabilities()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `InputDeviceInfo`, `MediaTrackCapabilities`*"]
#[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_capabilities(this: &InputDeviceInfo) -> MediaTrackCapabilities;
}
248 changes: 248 additions & 0 deletions crates/web-sys/src/features/gen_MediaTrackCapabilities.rs
@@ -0,0 +1,248 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaTrackCapabilities)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `MediaTrackCapabilities` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 MediaTrackCapabilities;
#[cfg(feature = "DoubleRange")]
#[wasm_bindgen(method, setter = "aspectRatio")]
fn aspect_ratio_shim(this: &MediaTrackCapabilities, val: &DoubleRange);
#[wasm_bindgen(method, setter = "autoGainControl")]
fn auto_gain_control_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
#[cfg(feature = "ULongRange")]
#[wasm_bindgen(method, setter = "channelCount")]
fn channel_count_shim(this: &MediaTrackCapabilities, val: &ULongRange);
#[wasm_bindgen(method, setter = "deviceId")]
fn device_id_shim(this: &MediaTrackCapabilities, val: &str);
#[wasm_bindgen(method, setter = "echoCancellation")]
fn echo_cancellation_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
#[wasm_bindgen(method, setter = "facingMode")]
fn facing_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
#[cfg(feature = "DoubleRange")]
#[wasm_bindgen(method, setter = "frameRate")]
fn frame_rate_shim(this: &MediaTrackCapabilities, val: &DoubleRange);
#[wasm_bindgen(method, setter = "groupId")]
fn group_id_shim(this: &MediaTrackCapabilities, val: &str);
#[cfg(feature = "ULongRange")]
#[wasm_bindgen(method, setter = "height")]
fn height_shim(this: &MediaTrackCapabilities, val: &ULongRange);
#[cfg(feature = "DoubleRange")]
#[wasm_bindgen(method, setter = "latency")]
fn latency_shim(this: &MediaTrackCapabilities, val: &DoubleRange);
#[wasm_bindgen(method, setter = "noiseSuppression")]
fn noise_suppression_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
#[wasm_bindgen(method, setter = "resizeMode")]
fn resize_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
#[cfg(feature = "ULongRange")]
#[wasm_bindgen(method, setter = "sampleRate")]
fn sample_rate_shim(this: &MediaTrackCapabilities, val: &ULongRange);
#[cfg(feature = "ULongRange")]
#[wasm_bindgen(method, setter = "sampleSize")]
fn sample_size_shim(this: &MediaTrackCapabilities, val: &ULongRange);
#[cfg(feature = "ULongRange")]
#[wasm_bindgen(method, setter = "width")]
fn width_shim(this: &MediaTrackCapabilities, val: &ULongRange);
}
#[cfg(web_sys_unstable_apis)]
impl MediaTrackCapabilities {
#[doc = "Construct a new `MediaTrackCapabilities`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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)]
#[cfg(feature = "DoubleRange")]
#[doc = "Change the `aspectRatio` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"]
#[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 aspect_ratio(&mut self, val: &DoubleRange) -> &mut Self {
self.aspect_ratio_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `autoGainControl` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
self.auto_gain_control_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "ULongRange")]
#[doc = "Change the `channelCount` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"]
#[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 channel_count(&mut self, val: &ULongRange) -> &mut Self {
self.channel_count_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `deviceId` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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_id(&mut self, val: &str) -> &mut Self {
self.device_id_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `echoCancellation` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
self.echo_cancellation_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `facingMode` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
self.facing_mode_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "DoubleRange")]
#[doc = "Change the `frameRate` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"]
#[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 frame_rate(&mut self, val: &DoubleRange) -> &mut Self {
self.frame_rate_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `groupId` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 group_id(&mut self, val: &str) -> &mut Self {
self.group_id_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "ULongRange")]
#[doc = "Change the `height` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"]
#[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 height(&mut self, val: &ULongRange) -> &mut Self {
self.height_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "DoubleRange")]
#[doc = "Change the `latency` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"]
#[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 latency(&mut self, val: &DoubleRange) -> &mut Self {
self.latency_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `noiseSuppression` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
self.noise_suppression_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `resizeMode` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
#[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 resize_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
self.resize_mode_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "ULongRange")]
#[doc = "Change the `sampleRate` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"]
#[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 sample_rate(&mut self, val: &ULongRange) -> &mut Self {
self.sample_rate_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "ULongRange")]
#[doc = "Change the `sampleSize` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"]
#[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 sample_size(&mut self, val: &ULongRange) -> &mut Self {
self.sample_size_shim(val);
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "ULongRange")]
#[doc = "Change the `width` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"]
#[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 width(&mut self, val: &ULongRange) -> &mut Self {
self.width_shim(val);
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for MediaTrackCapabilities {
fn default() -> Self {
Self::new()
}
}