Skip to main content

Primality

Trait Primality 

Source
pub trait Primality {
    // Required methods
    fn is_probably_prime(&self, witnesses: u32) -> bool;
    fn next_prime(&self) -> Self;
}
Expand description

Primality testing operations.

Required Methods§

Source

fn is_probably_prime(&self, witnesses: u32) -> bool

Returns true if the number is (probably) prime.

Uses Miller-Rabin with the given number of witnesses. With witnesses = 0, uses a deterministic set for small values and a sensible default count for large values.

Source

fn next_prime(&self) -> Self

Returns the next prime greater than self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§