Skip to content

Commit fbd9ec3

Browse files
authored
Merge pull request #620 from dhardy/fused
Implement TrustedLen and FusedIterator for DistIter
2 parents 7aec8e2 + c5735dc commit fbd9ec3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/distributions/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@
182182
//! [`Weibull`]: struct.Weibull.html
183183
//! [`WeightedIndex`]: struct.WeightedIndex.html
184184
185+
#[cfg(any(rust_1_26, features="nightly"))]
186+
use core::iter;
185187
use Rng;
186188

187189
pub use self::other::Alphanumeric;
@@ -314,6 +316,14 @@ impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T>
314316
}
315317
}
316318

319+
#[cfg(rust_1_26)]
320+
impl<'a, D, R, T> iter::FusedIterator for DistIter<'a, D, R, T>
321+
where D: Distribution<T>, R: Rng + 'a {}
322+
323+
#[cfg(features = "nightly")]
324+
impl<'a, D, R, T> iter::TrustedLen for DistIter<'a, D, R, T>
325+
where D: Distribution<T>, R: Rng + 'a {}
326+
317327

318328
/// A generic random value distribution, implemented for many primitive types.
319329
/// Usually generates values with a numerically uniform distribution, and with a

0 commit comments

Comments
 (0)