From 581e3bbb8775013fad49d78645229482429f2062 Mon Sep 17 00:00:00 2001 From: Gabriel Francisco Date: Fri, 22 Apr 2022 13:29:18 -0300 Subject: [PATCH] chore(napi): add u64 to BigInt conversion through From trait (#1143) * Add u64 to BigInt conversion through From trait * Fix lint --- crates/napi/src/bindgen_runtime/js_values/bigint.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/napi/src/bindgen_runtime/js_values/bigint.rs b/crates/napi/src/bindgen_runtime/js_values/bigint.rs index 3149c2e9..cf96a6c9 100644 --- a/crates/napi/src/bindgen_runtime/js_values/bigint.rs +++ b/crates/napi/src/bindgen_runtime/js_values/bigint.rs @@ -208,3 +208,12 @@ impl ToNapiValue for isize { Ok(raw_value) } } + +impl From for BigInt { + fn from(val: u64) -> Self { + BigInt { + sign_bit: false, + words: vec![val], + } + } +}