//! Arbitrarily large integers //! //! Traits to implement: //! * Add //! * AddAssign //! * Div //! * DivAssign //! * Mul //! * MulAssign //! * Neg //! * Rem //! * RemAssign //! * Sub //! * SubAssign use crate::{Sign, Unsigned}; #[derive(Debug)] pub struct BigInt { inner: Vec, sign: Sign, } impl Default for BigInt { fn default() -> Self { Self { inner: vec![], sign: Sign::Positive, } } } impl From for BigInt { fn from(n: T) -> Self { let mut new = Self::default(); if n > T::max_value() { new.split(n); } new } } impl BigInt { pub fn new() -> Self { Self::default() } /// Split an unsigned number into BigInt parts fn split(&mut self, num: T) -> Vec { // Pretty easy if you don't actually need to split the value! if num < T::max_value() { todo!(); // return vec![num as usize]; } todo!(); } } #[cfg(test)] mod tests {}