magic/bigint.rs

deno · libs/serde_v8/magic/bigint.rs · rust · MIT
dev-tools, tag:knn-classified

Wraps num_bigint::BigInt for V8 serialization/deserialization.

// Source: https://github.com/denoland/deno | License: MIT | Copyright 2018-2026 the Deno authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2018-2026 the Deno authors. MIT license.

use std::ops::Deref;
use std::ops::DerefMut;

use smallvec::SmallVec;
use smallvec::smallvec;

use super::transl8::FromV8;
use super::transl8::ToV8;
use crate::Error;
use crate::magic::transl8::impl_magic;

#[derive(PartialEq, Eq, Clone, Debug, Default)]
pub struct BigInt(num_bigint::BigInt);
impl_magic!(BigInt);

impl Deref for BigInt {
  type Target = num_bigint::BigInt;

  fn deref(&self) -> &Self::Target {
    &self.0
  }
}

impl DerefMut for BigInt {
  fn deref_mut(&mut self) -> &mut Self::Target {
    &mut self.0
  }
}

impl ToV8 for BigInt {
  fn to_v8<'scope, 'i>(
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key