mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-25 19:11:45 +03:00
rebase to handle JsString
This commit is contained in:
parent
233b35254f
commit
32bc9f271c
@ -249,14 +249,14 @@ extern {
|
|||||||
///
|
///
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
|
||||||
#[wasm_bindgen(catch, method, js_name = toFixed)]
|
#[wasm_bindgen(catch, method, js_name = toFixed)]
|
||||||
pub fn to_fixed(this: &Number, digits: u8) -> Result<String, JsValue>;
|
pub fn to_fixed(this: &Number, digits: u8) -> Result<JsString, JsValue>;
|
||||||
|
|
||||||
/// The toExponential() method returns a string representing the Number
|
/// The toExponential() method returns a string representing the Number
|
||||||
/// object in exponential notation.
|
/// object in exponential notation.
|
||||||
///
|
///
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential
|
||||||
#[wasm_bindgen(catch, method, js_name = toExponential)]
|
#[wasm_bindgen(catch, method, js_name = toExponential)]
|
||||||
pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result<String, JsValue>;
|
pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result<JsString, JsValue>;
|
||||||
|
|
||||||
/// The toString() method returns a string representing the
|
/// The toString() method returns a string representing the
|
||||||
/// specified Number object.
|
/// specified Number object.
|
||||||
|
@ -138,11 +138,11 @@ fn to_fixed() {
|
|||||||
use wasm_bindgen::js;
|
use wasm_bindgen::js;
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[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 = this.to_fixed(digits);
|
||||||
let result = match result {
|
let result = match result {
|
||||||
Ok(num) => num,
|
Ok(num) => num,
|
||||||
Err(_err) => "RangeError".to_string()
|
Err(_err) => "RangeError".into()
|
||||||
};
|
};
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
@ -170,11 +170,11 @@ fn to_exponential() {
|
|||||||
use wasm_bindgen::js;
|
use wasm_bindgen::js;
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[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 = this.to_exponential(fraction_digits);
|
||||||
let result = match result {
|
let result = match result {
|
||||||
Ok(num) => num,
|
Ok(num) => num,
|
||||||
Err(_err) => "RangeError".to_string()
|
Err(_err) => "RangeError".into()
|
||||||
};
|
};
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user