Struct primes::TrialDivision
source · [−]pub struct TrialDivision { /* private fields */ }Expand description
A prime generator, using the Trial Division method.
Create with let mut pset = TrialDivision::new(), and then use pset.iter() to iterate over all
primes.
Implementations
sourceimpl TrialDivision
impl TrialDivision
sourcepub fn new() -> TrialDivision
pub fn new() -> TrialDivision
A new prime generator, primed with 2 and 3
Trait Implementations
sourceimpl Clone for TrialDivision
impl Clone for TrialDivision
sourcefn clone(&self) -> TrialDivision
fn clone(&self) -> TrialDivision
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Default for TrialDivision
impl Default for TrialDivision
sourcefn default() -> TrialDivision
fn default() -> TrialDivision
Returns the “default value” for a type. Read more
sourceimpl Index<usize> for TrialDivision
impl Index<usize> for TrialDivision
sourceimpl PrimeSetBasics for TrialDivision
impl PrimeSetBasics for TrialDivision
Auto Trait Implementations
impl RefUnwindSafe for TrialDivision
impl Send for TrialDivision
impl Sync for TrialDivision
impl Unpin for TrialDivision
impl UnwindSafe for TrialDivision
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<P> PrimeSet for P where
P: PrimeSetBasics,
impl<P> PrimeSet for P where
P: PrimeSetBasics,
fn is_empty(&self) -> bool
sourcefn generator(&mut self) -> PrimeSetIter<'_, Self>ⓘNotable traits for PrimeSetIter<'a, P>impl<'a, P: PrimeSet> Iterator for PrimeSetIter<'a, P> type Item = u64;
fn generator(&mut self) -> PrimeSetIter<'_, Self>ⓘNotable traits for PrimeSetIter<'a, P>impl<'a, P: PrimeSet> Iterator for PrimeSetIter<'a, P> type Item = u64;
Iterator over all primes not yet found
sourcefn iter(&mut self) -> PrimeSetIter<'_, Self>ⓘNotable traits for PrimeSetIter<'a, P>impl<'a, P: PrimeSet> Iterator for PrimeSetIter<'a, P> type Item = u64;
fn iter(&mut self) -> PrimeSetIter<'_, Self>ⓘNotable traits for PrimeSetIter<'a, P>impl<'a, P: PrimeSet> Iterator for PrimeSetIter<'a, P> type Item = u64;
Iterator over all primes, starting with 2. If you don’t care about the “state” of the
PrimeSet, this is what you want! Read more
sourcefn find_vec(&self, n: u64) -> Option<(usize, u64)>
fn find_vec(&self, n: u64) -> Option<(usize, u64)>
Find the next largest prime from a number, if it is within the already-found list Read more
sourcefn prime_factors(&mut self, n: u64) -> Vec<u64>
fn prime_factors(&mut self, n: u64) -> Vec<u64>
Get the prime factors of a number, starting from 2, including repeats
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more