Truly independent web browser
Meta+LibWeb: Support unsigned short in the Rust bindings
Shannon Boothb7825247fc80
diff --git a/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs b/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rsindex 12bbb436e93..97b4aa621ac 100644--- a/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/bindings/conversions.rs@@ -1017,6 +1017,13 @@ impl ToJs for i16 {}}+/// https://webidl.spec.whatwg.org/#js-unsigned-short+impl ToJs for u16 {+ fn to_js(self, _: &CallContext) -> ThrowCompletionOr<Value> {+ Ok(Value::from_i32(i32::from(self)))+ }+}+/// https://webidl.spec.whatwg.org/#js-longimpl ToJs for i32 {fn to_js(self, _: &CallContext) -> ThrowCompletionOr<Value> {diff --git a/Meta/Generators/libweb_bindings/rust_types.py b/Meta/Generators/libweb_bindings/rust_types.pyindex 0cca9e50e1a..5ab4e37d151 100644--- a/Meta/Generators/libweb_bindings/rust_types.py+++ b/Meta/Generators/libweb_bindings/rust_types.py@@ -50,7 +50,14 @@ SUPPORTED_TYPE_EXTENDED_ATTRIBUTES = {}# The integer types, with the Rust type of their values.-INTEGER_TYPES = {"short": "i16", "long": "i32", "unsigned long": "u32", "long long": "i64", "unsigned long long": "u64"}+INTEGER_TYPES = {+ "short": "i16",+ "unsigned short": "u16",+ "long": "i32",+ "unsigned long": "u32",+ "long long": "i64",+ "unsigned long long": "u64",+}# The floating point types, with the Rust type of their values.FLOATING_POINT_TYPES = {"float": "f32", "unrestricted float": "f32", "double": "f64", "unrestricted double": "f64"}