diff --git a/crates/neon/src/types_impl/bigint.rs b/crates/neon/src/types_impl/bigint.rs index 6bb063091..34b059a16 100644 --- a/crates/neon/src/types_impl/bigint.rs +++ b/crates/neon/src/types_impl/bigint.rs @@ -2,13 +2,12 @@ use std::{error, fmt, mem::MaybeUninit}; -use crate::prelude::NeonResult; use crate::{ - context::Context, - handle::Handle, - result::ResultExt, - sys::{self}, - types::JsBigInt, + context::{internal::Env, Context}, + handle::{internal::TransparentNoCopyWrapper, Handle, Managed}, + result::{NeonResult, ResultExt}, + sys::{self, raw}, + types::{private, JsBigInt, Value}, }; #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -417,3 +416,33 @@ impl JsBigInt { self.read_digits_le(cx, &mut []).1 } } + +impl Value for JsBigInt {} + +unsafe impl TransparentNoCopyWrapper for JsBigInt { + type Inner = raw::Local; + + fn into_inner(self) -> Self::Inner { + self.0 + } +} + +impl Managed for JsBigInt { + fn to_raw(&self) -> raw::Local { + self.0 + } + + fn from_raw(_: Env, h: raw::Local) -> Self { + Self(h) + } +} + +impl private::ValueInternal for JsBigInt { + fn name() -> String { + "BigInt".to_string() + } + + fn is_typeof(env: Env, other: &Other) -> bool { + unsafe { sys::tag::is_bigint(env.to_raw(), other.to_raw()) } + } +} diff --git a/crates/neon/src/types_impl/mod.rs b/crates/neon/src/types_impl/mod.rs index cfab3aa93..2650a0d60 100644 --- a/crates/neon/src/types_impl/mod.rs +++ b/crates/neon/src/types_impl/mod.rs @@ -1281,37 +1281,3 @@ impl private::ValueInternal for JsFunction { /// } /// ``` pub struct JsBigInt(raw::Local); - -#[cfg(feature = "napi-6")] -impl Value for JsBigInt {} - -#[cfg(feature = "napi-6")] -unsafe impl TransparentNoCopyWrapper for JsBigInt { - type Inner = raw::Local; - - fn into_inner(self) -> Self::Inner { - self.0 - } -} - -#[cfg(feature = "napi-6")] -impl Managed for JsBigInt { - fn to_raw(&self) -> raw::Local { - self.0 - } - - fn from_raw(_: Env, h: raw::Local) -> Self { - Self(h) - } -} - -#[cfg(feature = "napi-6")] -impl private::ValueInternal for JsBigInt { - fn name() -> String { - "BigInt".to_string() - } - - fn is_typeof(env: Env, other: &Other) -> bool { - unsafe { sys::tag::is_bigint(env.to_raw(), other.to_raw()) } - } -}