serde_json/lexical/
bignum.rs

1// Adapted from https://github.com/Alexhuszagh/rust-lexical.
2
3//! Big integer type definition.
4
5use super::math::*;
6#[allow(unused_imports)]
7use alloc::vec::Vec;
8
9/// Storage for a big integer type.
10#[derive(Clone, PartialEq, Eq)]
11pub(crate) struct Bigint {
12    /// Internal storage for the Bigint, in little-endian order.
13    pub(crate) data: Vec<Limb>,
14}
15
16impl Default for Bigint {
17    fn default() -> Self {
18        Bigint {
19            data: Vec::with_capacity(20),
20        }
21    }
22}
23
24impl Math for Bigint {
25    #[inline]
26    fn data(&self) -> &Vec<Limb> {
27        &self.data
28    }
29
30    #[inline]
31    fn data_mut(&mut self) -> &mut Vec<Limb> {
32        &mut self.data
33    }
34}