Crate const_num_bigint

Crate const_num_bigint 

Source
Expand description

const

    use const_num_bigint::*;
    use std::str::FromStr;
    const TEST_INT : &'static BigInt = bigint!("123");
    let bigint = BigInt::from_str("123").unwrap();
    assert!(&bigint==TEST_INT);
    const TEST_INT2 : &'static BigInt = bigint!("-123");
    let bigint2 = BigInt::from_str("-123").unwrap();
    assert!(&bigint2==TEST_INT2);
    const TEST_INT3 : &'static BigInt =
        bigint!("123123123123123123123123123123123123123123123123123123123123123123123123123123");
    let bigint3 = BigInt::from_str(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    ).unwrap();
    assert!(&bigint3==TEST_INT3);
    const TEST_UINT : &'static BigUint = biguint!(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    );
    let biguint = BigUint::from_str(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    ).unwrap();
    assert!(&biguint==TEST_UINT);
    assert!(&biguint==
        biguint!("123123123123123123123123123123123123123123123123123123123123123123123123123123")
    );
    let pi_str = include_str!("pi.num");
    let biguint_pi = BigUint::from_str(pi_str).unwrap();
    assert!(&biguint_pi==
        biguint_file!("src/pi.num")
    );

Macros§

bigint
bigint_file
bigint_file_with_crate
bigint_with_crate
biguint
biguint_file
biguint_file_with_crate
biguint_with_crate
from_slice

Structs§

BigInt
A big signed integer type.
BigUint
A big unsigned integer type.
ConstBigInt
ConstBigUint
ParseBigIntError
TryFromBigIntError
The error type returned when a checked conversion regarding big integer fails.
U32Digits
An iterator of u32 digits representation of a BigUint or BigInt, ordered least significant digit first.
U64Digits
An iterator of u64 digits representation of a BigUint or BigInt, ordered least significant digit first.

Enums§

Sign
A Sign is a BigInt’s composing element.

Traits§

ToBigInt
A generic trait for converting a value to a BigInt. This may return None when converting from f32 or f64, and will always succeed when converting from any integer or unsigned primitive, or BigUint.
ToBigUint
A generic trait for converting a value to a BigUint.