mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-24 18:43:33 +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
|
||||
#[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
|
||||
/// 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<String, JsValue>;
|
||||
pub fn to_exponential(this: &Number, fraction_digits: u8) -> Result<JsString, JsValue>;
|
||||
|
||||
/// The toString() method returns a string representing the
|
||||
/// specified Number object.
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user