diff options
Diffstat (limited to 'src/tuple_impl.rs')
-rw-r--r-- | src/tuple_impl.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/tuple_impl.rs b/src/tuple_impl.rs index 1d24b0b..ca8b97c 100644 --- a/src/tuple_impl.rs +++ b/src/tuple_impl.rs @@ -1,6 +1,7 @@ //! Some iterator that produces tuples use std::iter::Fuse; +use std::iter::FusedIterator; use std::iter::Take; use std::iter::Cycle; use std::marker::PhantomData; @@ -19,8 +20,8 @@ impl<T: TupleCollect> HomogeneousTuple for T {} /// An iterator over a incomplete tuple. /// -/// See [`.tuples()`](../trait.Itertools.html#method.tuples) and -/// [`Tuples::into_buffer()`](struct.Tuples.html#method.into_buffer). +/// See [`.tuples()`](crate::Itertools::tuples) and +/// [`Tuples::into_buffer()`]. #[derive(Clone, Debug)] pub struct TupleBuffer<T> where T: HomogeneousTuple @@ -75,7 +76,7 @@ impl<T> ExactSizeIterator for TupleBuffer<T> /// An iterator that groups the items in tuples of a specific size. /// -/// See [`.tuples()`](../trait.Itertools.html#method.tuples) for more information. +/// See [`.tuples()`](crate::Itertools::tuples) for more information. #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub struct Tuples<I, T> @@ -130,7 +131,7 @@ impl<I, T> Tuples<I, T> /// An iterator over all contiguous windows that produces tuples of a specific size. /// -/// See [`.tuple_windows()`](../trait.Itertools.html#method.tuple_windows) for more +/// See [`.tuple_windows()`](crate::Itertools::tuple_windows) for more /// information. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Clone, Debug)] @@ -187,11 +188,17 @@ impl<I, T> Iterator for TupleWindows<I, T> } } +impl<I, T> FusedIterator for TupleWindows<I, T> + where I: FusedIterator<Item = T::Item>, + T: HomogeneousTuple + Clone, + T::Item: Clone +{} + /// An iterator over all windows,wrapping back to the first elements when the /// window would otherwise exceed the length of the iterator, producing tuples /// of a specific size. /// -/// See [`.circular_tuple_windows()`](../trait.Itertools.html#method.circular_tuple_windows) for more +/// See [`.circular_tuple_windows()`](crate::Itertools::circular_tuple_windows) for more /// information. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Debug)] @@ -248,9 +255,6 @@ macro_rules! count_ident{ () => {0}; ($i0:ident, $($i:ident,)*) => {1 + count_ident!($($i,)*)}; } -macro_rules! ignore_ident{ - ($id:ident, $($t:tt)*) => {$($t)*}; -} macro_rules! rev_for_each_ident{ ($m:ident, ) => {}; ($m:ident, $i0:ident, $($i:ident,)*) => { @@ -317,7 +321,7 @@ macro_rules! impl_tuple_collect { let &mut ($(ref mut $Y),*,) = self; macro_rules! replace_item{($i:ident) => { item = replace($i, item); - }}; + }} rev_for_each_ident!(replace_item, $($Y,)*); drop(item); } |