From ac4bb3754c37fe3d8e0629f82f5961336b116531 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 23 Jul 2021 17:58:59 +0200 Subject: [PATCH] Add more inlines --- crates/js-sys/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 2db0d4bc00c..03fc5b516ca 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -904,6 +904,7 @@ impl BigInt { /// Applies the binary `**` JS operator on the two `BigInt`s. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation) + #[inline] pub fn pow(&self, rhs: &Self) -> Self { JsValue::as_ref(self) .pow(JsValue::as_ref(rhs)) @@ -1027,6 +1028,7 @@ impl Default for BigInt { impl FromStr for BigInt { type Err = Infallible; + #[inline] fn from_str(s: &str) -> Result { Ok(BigInt::new(&s.into())) } @@ -1090,6 +1092,7 @@ impl Default for Boolean { impl Not for &Boolean { type Output = Boolean; + #[inline] fn not(self) -> Self::Output { (!JsValue::as_ref(self)).into() } @@ -2247,6 +2250,7 @@ impl Number { /// Applies the binary `**` JS operator on the two `Number`s. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation) + #[inline] pub fn pow(&self, rhs: &Self) -> Self { JsValue::as_ref(self) .pow(JsValue::as_ref(rhs)) @@ -2256,6 +2260,7 @@ impl Number { /// Applies the binary `>>>` JS operator on the two `Number`s. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift) + #[inline] pub fn unsigned_shr(&self, rhs: &Self) -> Self { Number::from(JsValue::as_ref(self).unsigned_shr(JsValue::as_ref(rhs))) } @@ -2323,6 +2328,7 @@ impl PartialEq for Number { impl Not for &Number { type Output = BigInt; + #[inline] fn not(self) -> Self::Output { JsValue::as_ref(self).bit_not().unchecked_into() } @@ -2342,6 +2348,7 @@ forward_js_binop!(impl Mul, mul for Number); forward_js_binop!(impl Rem, rem for Number); impl PartialOrd for Number { + #[inline] fn partial_cmp(&self, other: &Self) -> Option { if Number::is_nan(self) || Number::is_nan(other) { None @@ -2354,18 +2361,22 @@ impl PartialOrd for Number { } } + #[inline] fn lt(&self, other: &Self) -> bool { JsValue::as_ref(self).lt(JsValue::as_ref(other)) } + #[inline] fn le(&self, other: &Self) -> bool { JsValue::as_ref(self).le(JsValue::as_ref(other)) } + #[inline] fn ge(&self, other: &Self) -> bool { JsValue::as_ref(self).ge(JsValue::as_ref(other)) } + #[inline] fn gt(&self, other: &Self) -> bool { JsValue::as_ref(self).gt(JsValue::as_ref(other)) } @@ -2375,6 +2386,7 @@ impl FromStr for Number { type Err = Infallible; #[allow(deprecated)] + #[inline] fn from_str(s: &str) -> Result { Ok(Number::new_from_str(s)) }