Skip to content

Commit bb4cba5

Browse files
committed
impl_wasm_traits!
1 parent 2ccb96e commit bb4cba5

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

crates/float/src/js_api.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use std::{
55
ops::{Add, Div, Mul, Neg, Sub},
66
str::FromStr,
77
};
8-
use wasm_bindgen_utils::prelude::{js_sys::BigInt, *};
8+
use wasm_bindgen_utils::{
9+
impl_wasm_traits,
10+
prelude::{js_sys::BigInt, *},
11+
};
912

1013
#[wasm_bindgen]
1114
pub struct FromFixedDecimalLossyResult {
@@ -27,17 +30,11 @@ impl FromFixedDecimalLossyResult {
2730
}
2831

2932
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Tsify)]
30-
#[tsify(into_wasm_abi, from_wasm_abi)]
3133
pub struct ToFixedDecimalLossyResult {
3234
pub value: String,
3335
pub lossless: bool,
3436
}
35-
36-
impl From<ToFixedDecimalLossyResult> for JsValue {
37-
fn from(val: ToFixedDecimalLossyResult) -> Self {
38-
serde_wasm_bindgen::to_value(&val).unwrap()
39-
}
40-
}
37+
impl_wasm_traits!(ToFixedDecimalLossyResult);
4138

4239
#[wasm_bindgen]
4340
impl Float {

0 commit comments

Comments
 (0)