|
impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> |
|
where D: Distribution<T>, R: Rng + 'a |
|
{ |
|
type Item = T; |
|
|
|
#[inline(always)] |
|
fn next(&mut self) -> Option<T> { |
|
Some(self.distr.sample(self.rng)) |
|
} |
|
|
|
fn size_hint(&self) -> (usize, Option<usize>) { |
|
(usize::max_value(), None) |
|
} |
|
} |
The DistIter iterator might benefit from the following additional implementations:
DoubleEndedIterator
TrustedLen
FusedIterator
Additionally, it's recommended that custom iterators implement try_fold, which is the base method used for all other non-lazy iterator operations.
rand/src/distributions/mod.rs
Lines 302 to 315 in 7aec8e2
The
DistIteriterator might benefit from the following additional implementations:DoubleEndedIteratorTrustedLenFusedIteratorAdditionally, it's recommended that custom iterators implement
try_fold, which is the base method used for all other non-lazy iterator operations.