Implement TrustedLen for Take<Repeat> and Take<RangeFrom>
This commit is contained in:
@@ -2322,6 +2322,9 @@ impl<I> ExactSizeIterator for Take<I> where I: ExactSizeIterator {}
|
|||||||
#[unstable(feature = "fused", issue = "35602")]
|
#[unstable(feature = "fused", issue = "35602")]
|
||||||
impl<I> FusedIterator for Take<I> where I: FusedIterator {}
|
impl<I> FusedIterator for Take<I> where I: FusedIterator {}
|
||||||
|
|
||||||
|
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||||
|
unsafe impl<I: TrustedLen> TrustedLen for Take<I> {}
|
||||||
|
|
||||||
/// An iterator to maintain state while iterating another iterator.
|
/// An iterator to maintain state while iterating another iterator.
|
||||||
///
|
///
|
||||||
/// This `struct` is created by the [`scan`] method on [`Iterator`]. See its
|
/// This `struct` is created by the [`scan`] method on [`Iterator`]. See its
|
||||||
|
|||||||
@@ -325,6 +325,9 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {
|
|||||||
#[unstable(feature = "fused", issue = "35602")]
|
#[unstable(feature = "fused", issue = "35602")]
|
||||||
impl<A: Step> FusedIterator for ops::RangeFrom<A> {}
|
impl<A: Step> FusedIterator for ops::RangeFrom<A> {}
|
||||||
|
|
||||||
|
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||||
|
unsafe impl<A: Step> TrustedLen for ops::RangeFrom<A> {}
|
||||||
|
|
||||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||||
impl<A: Step> Iterator for ops::RangeInclusive<A> {
|
impl<A: Step> Iterator for ops::RangeInclusive<A> {
|
||||||
type Item = A;
|
type Item = A;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ impl<A: Clone> DoubleEndedIterator for Repeat<A> {
|
|||||||
#[unstable(feature = "fused", issue = "35602")]
|
#[unstable(feature = "fused", issue = "35602")]
|
||||||
impl<A: Clone> FusedIterator for Repeat<A> {}
|
impl<A: Clone> FusedIterator for Repeat<A> {}
|
||||||
|
|
||||||
|
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||||
|
unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
|
||||||
|
|
||||||
/// Creates a new iterator that endlessly repeats a single element.
|
/// Creates a new iterator that endlessly repeats a single element.
|
||||||
///
|
///
|
||||||
/// The `repeat()` function repeats a single value over and over and over and
|
/// The `repeat()` function repeats a single value over and over and over and
|
||||||
|
|||||||
Reference in New Issue
Block a user