Enum rug::integer::IsPrime[][src]

pub enum IsPrime {
    No,
    Probably,
    Yes,
}

Whether a number is prime.

See the Integer::is_probably_prime method.

Examples

use rug::{integer::IsPrime, Integer};
let no = Integer::from(163 * 4003);
assert_eq!(no.is_probably_prime(30), IsPrime::No);
let yes = Integer::from(817_504_243);
assert_eq!(yes.is_probably_prime(30), IsPrime::Yes);
// 16_412_292_043_871_650_369 is actually a prime.
let probably = Integer::from(16_412_292_043_871_650_369_u64);
assert_eq!(probably.is_probably_prime(30), IsPrime::Probably);

Variants

No

The number is definitely not prime.

Probably

The number is probably prime.

Yes

The number is definitely prime.

Trait Implementations

impl Clone for IsPrime[src]

impl Copy for IsPrime[src]

impl Debug for IsPrime[src]

impl Eq for IsPrime[src]

impl Hash for IsPrime[src]

impl Ord for IsPrime[src]

impl PartialEq<IsPrime> for IsPrime[src]

impl PartialOrd<IsPrime> for IsPrime[src]

impl StructuralEq for IsPrime[src]

impl StructuralPartialEq for IsPrime[src]

Auto Trait Implementations

impl RefUnwindSafe for IsPrime

impl Send for IsPrime

impl Sync for IsPrime

impl Unpin for IsPrime

impl UnwindSafe for IsPrime

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Az for T[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedAs for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> OverflowingAs for T[src]

impl<T> SaturatingAs for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnwrappedAs for T[src]

impl<T> WrappingAs for T[src]