Expand description
Arbitrary-precision integers.
This module provides support for arbitrary-precision integers of type
Integer. Instances of Integer always have a heap allocation for the bit
data; if you want a temporary small integer without heap allocation, you can use
the MiniInteger type.
§Examples
use rug::integer::MiniInteger;
use rug::Assign;
use rug::Integer;
let mut int = Integer::from(10);
assert_eq!(int, 10);
let small = MiniInteger::from(-15);
// `small` can be borrowed like an `Integer` in the following line:
int.assign(small.borrow().abs_ref());
assert_eq!(int, 15);Structs§
- Borrow
Integer - Used to get a reference to an
Integer. - Mini
Integer - A small integer that does not require any memory allocation.
- Parse
Integer Error - An error which can be returned when parsing an
Integer. - Small
Integer Deprecated - A small integer that did not require any memory allocation until version 1.23.0.
- TryFrom
Integer Error - An error which can be returned when a checked conversion from
Integerfails.
Enums§
- IsPrime
- Whether a number is prime.
- Order
- The ordering of digits inside a slice, and bytes inside a digit.
Traits§
- Integer
Ext64 Integerextension trait with 64-bit alternatives of some methods.- ToMini
- Types implementing this trait can be converted to
MiniInteger. - ToSmall
Deprecated - Types implementing this trait can be converted to
SmallInteger. - Unsigned
Primitive - Conversions between
Integerand a slice of digits of this type are provided.