From 32bc9f271c4c574847d29576d94ba60f3c2c4b54 Mon Sep 17 00:00:00 2001 From: Sendil Kumar Date: Sun, 24 Jun 2018 20:48:37 +0200 Subject: [PATCH] rebase to handle JsString --- src/js.rs | 4 ++-- tests/all/js_globals/Number.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js.rs b/src/js.rs index e20a1941c..c5f0d51ec 100644 --- a/src/js.rs +++ b/src/js.rs @@ -249,14 +249,14 @@ extern { /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed #[wasm_bindgen(catch, method, js_name = toFixed)] - pub fn to_fixed(this: &Number, digits: u8) -> Result; + pub fn to_fixed(this: &Number, digits: u8) -> Result; /// The toExponential() method returns a string representing the Number /// object in exponential notation. /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential #[wasm_bindgen(catch, method, js_name = toExponential)] - pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result; + pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result; /// The toString() method returns a string representing the /// specified Number object. diff --git a/tests/all/js_globals/Number.rs b/tests/all/js_globals/Number.rs index 8b55f3565..362832e4c 100644 --- a/tests/all/js_globals/Number.rs +++ b/tests/all/js_globals/Number.rs @@ -138,11 +138,11 @@ fn to_fixed() { use wasm_bindgen::js; #[wasm_bindgen] - pub fn to_fixed(this: &js::Number, digits: u8) -> String { + pub fn to_fixed(this: &js::Number, digits: u8) -> js::JsString { let result = this.to_fixed(digits); let result = match result { Ok(num) => num, - Err(_err) => "RangeError".to_string() + Err(_err) => "RangeError".into() }; result } @@ -170,11 +170,11 @@ fn to_exponential() { use wasm_bindgen::js; #[wasm_bindgen] - pub fn to_exponential(this: &js::Number, fraction_digits: u8) -> String { + pub fn to_exponential(this: &js::Number, fraction_digits: u8) -> js::JsString { let result = this.to_exponential(fraction_digits); let result = match result { Ok(num) => num, - Err(_err) => "RangeError".to_string() + Err(_err) => "RangeError".into() }; result }