pub enum NamedGenerator {
Fib,
FibUntil,
Pow2,
Pow2Until,
Binomial,
Geometric,
GeometricUntil,
LinearStarts,
LinearSteps,
LogSteps,
}Expand description
A named generator: a call in source position that expands its literal arguments into a finite list of values (comprehension_forms.md §3.1.3, “Named generators”).
Variants§
Fib
fib(n): the first n Fibonacci numbers.
FibUntil
fib_until(max): the Fibonacci numbers up to max.
Pow2
pow2(n): the first n powers of two.
Pow2Until
pow2_until(max): the powers of two up to max.
Binomial
binomial(n): row n of Pascal’s triangle.
Geometric
geometric(start, factor, n): n terms of a geometric series.
GeometricUntil
geometric_until(start, factor, max): a geometric series up to max.
LinearStarts
linear_starts(start, end, n): the starts of n equal steps.
LinearSteps
linear_steps(start, end, n): n evenly spaced points, both ends included.
LogSteps
log_steps(start, end, n): n log-spaced points, both ends included.
Implementations§
Source§impl NamedGenerator
impl NamedGenerator
Sourcepub fn all() -> impl Iterator<Item = NamedGenerator>
pub fn all() -> impl Iterator<Item = NamedGenerator>
Every named generator, in declaration order.
Sourcepub fn of_call(text: &str) -> Option<Self>
pub fn of_call(text: &str) -> Option<Self>
The generator text calls, when it is a call of one
(fib({n}), log_steps(1, 1000, 4)).
Sourcepub fn yields_integers(self) -> bool
pub fn yields_integers(self) -> bool
Whether the generator’s values are integers (u64); the others
yield floats (f64).
Sourcepub fn largest_valid_argument(self) -> Option<u64>
pub fn largest_valid_argument(self) -> Option<u64>
The largest argument a call yields every term of, for a
generator whose terms outgrow u64 as its argument grows:
fib 93, pow2 64, binomial 67. None for the others.
Trait Implementations§
Source§impl Clone for NamedGenerator
impl Clone for NamedGenerator
impl Copy for NamedGenerator
Source§impl Debug for NamedGenerator
impl Debug for NamedGenerator
impl Eq for NamedGenerator
Source§impl PartialEq for NamedGenerator
impl PartialEq for NamedGenerator
impl StructuralPartialEq for NamedGenerator
Auto Trait Implementations§
impl Freeze for NamedGenerator
impl RefUnwindSafe for NamedGenerator
impl Send for NamedGenerator
impl Sync for NamedGenerator
impl Unpin for NamedGenerator
impl UnsafeUnpin for NamedGenerator
impl UnwindSafe for NamedGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more