Skip to content

Commit 32bc9f2

Browse files
committed
rebase to handle JsString
1 parent 233b352 commit 32bc9f2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/js.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ extern {
249249
///
250250
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
251251
#[wasm_bindgen(catch, method, js_name = toFixed)]
252-
pub fn to_fixed(this: &Number, digits: u8) -> Result<String, JsValue>;
252+
pub fn to_fixed(this: &Number, digits: u8) -> Result<JsString, JsValue>;
253253

254254
/// The toExponential() method returns a string representing the Number
255255
/// object in exponential notation.
256256
///
257257
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential
258258
#[wasm_bindgen(catch, method, js_name = toExponential)]
259-
pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result<String, JsValue>;
259+
pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result<JsString, JsValue>;
260260

261261
/// The toString() method returns a string representing the
262262
/// specified Number object.

tests/all/js_globals/Number.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ fn to_fixed() {
138138
use wasm_bindgen::js;
139139
140140
#[wasm_bindgen]
141-
pub fn to_fixed(this: &js::Number, digits: u8) -> String {
141+
pub fn to_fixed(this: &js::Number, digits: u8) -> js::JsString {
142142
let result = this.to_fixed(digits);
143143
let result = match result {
144144
Ok(num) => num,
145-
Err(_err) => "RangeError".to_string()
145+
Err(_err) => "RangeError".into()
146146
};
147147
result
148148
}
@@ -170,11 +170,11 @@ fn to_exponential() {
170170
use wasm_bindgen::js;
171171
172172
#[wasm_bindgen]
173-
pub fn to_exponential(this: &js::Number, fraction_digits: u8) -> String {
173+
pub fn to_exponential(this: &js::Number, fraction_digits: u8) -> js::JsString {
174174
let result = this.to_exponential(fraction_digits);
175175
let result = match result {
176176
Ok(num) => num,
177-
Err(_err) => "RangeError".to_string()
177+
Err(_err) => "RangeError".into()
178178
};
179179
result
180180
}

0 commit comments

Comments
 (0)