Module rug::integer [] [src]

Aribtrary-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 SmallInteger type.

Examples

use rug::{Assign, Integer};
use rug::integer::SmallInteger;
let mut int = Integer::from(10);
assert_eq!(int, 10);
let small = SmallInteger::from(-15);
// `small` behaves like an `Integer` in the following line:
int.assign(small.abs_ref());
assert_eq!(int, 15);

Structs

ParseIntegerError

An error which can be returned when parsing an Integer.

SmallInteger

A small integer that does not require any memory allocation.

ValidInteger

A validated string that can always be converted to an Integer.

Enums

IsPrime

Whether a number is prime.