pub trait PrimeBuffer<'a> {
type PrimeIter: Iterator<Item = &'a u64>;
// Required methods
fn iter(&'a self) -> Self::PrimeIter;
fn reserve(&mut self, limit: u64);
fn bound(&self) -> u64;
fn contains(&self, num: u64) -> bool;
fn clear(&mut self);
}Expand description
This trait represents a general data structure that stores primes.
It’s recommended to store at least a bunch of small primes in the buffer to make some of the algorithms more efficient.
Required Associated Types§
Required Methods§
Sourcefn reserve(&mut self, limit: u64)
fn reserve(&mut self, limit: u64)
Generate primes until the largest prime in the buffer is equal or larger than limit
Sourcefn contains(&self, num: u64) -> bool
fn contains(&self, num: u64) -> bool
Test if the number is in the buffer. If a number is not in the buffer, then it’s either a composite or large than PrimeBuffer::bound()