pub struct BigInt { /* private fields */ }Expand description
Dynamic-length BigInt.
This type uses heap allocation and can grow up to max_limbs.
It enforces canonical form (no leading zeros, zero sign rules).
Implementations§
Source§impl BigInt
impl BigInt
Sourcepub fn new(max_limbs: usize) -> Self
pub fn new(max_limbs: usize) -> Self
Create a new BigInt with the specified maximum limb count.
Sourcepub fn from_limbs(limbs: &[Limb], max_limbs: usize) -> Result<Self>
pub fn from_limbs(limbs: &[Limb], max_limbs: usize) -> Result<Self>
Create a BigInt from a slice of limbs.
The limbs are assumed to be in little-endian order.
Sourcepub fn ensure_capacity(&mut self, n: usize) -> Result<()>
pub fn ensure_capacity(&mut self, n: usize) -> Result<()>
Ensure capacity for at least n limbs.
Trait Implementations§
Source§impl BigIntCore for BigInt
Available on crate feature alloc only.
impl BigIntCore for BigInt
Available on crate feature
alloc only.Source§fn limb_count(&self) -> usize
fn limb_count(&self) -> usize
Get the number of limbs.
Auto Trait Implementations§
impl Freeze for BigInt
impl RefUnwindSafe for BigInt
impl Send for BigInt
impl Sync for BigInt
impl Unpin for BigInt
impl UnwindSafe for BigInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more