[][src]Struct red_primality::PrimeIter

pub struct PrimeIter { /* fields omitted */ }

PrimeIter returns a sequence of primes in ascending order.

Panics

This iterator will panic if it tries to generate a prime larger than std::u64::MAX.

To avoid panicking, use Iterator::take_while() or some other mechanism for limiting consumption.

Methods

impl PrimeIter[src]

pub fn from(n: u64) -> Self[src]

Returns an iterator that generates all u64 primes in ascending order starting at the first on or after the parameter n.

Example

use red_primality::PrimeIter;

fn main() {
    let small_primes: Vec<u64> = PrimeIter::from(5).take_while(|n| n < &20).collect();
    assert_eq!(small_primes, vec![5, 7, 11, 13, 17, 19]);
}

pub fn all() -> Self[src]

Returns an iterator that generates all u64 primes in ascending order.

Trait Implementations

impl Clone for PrimeIter[src]

impl From<PrimeIter> for CertIter[src]

impl Iterator for PrimeIter[src]

type Item = u64

The type of the elements being iterated over.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.