#[macro_export]
macro_rules! pub_iterator_type {
( #[$($attr:tt)*] $Name:ident [ $($NameParam:tt)* ] = $From:ty ) => {
#[$($attr)*]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct $Name < $($NameParam)* > ( $From );
impl< $($NameParam)* > Iterator for $Name < $($NameParam)* > {
type Item = < $From as Iterator>::Item;
fn next(&mut self) -> Option<Self::Item> {
self.0.next()
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.0.size_hint()
}
}
};
( #[$($attr:tt)*] $Name:ident [ $($NameParam:tt)* ] = $From:ty where $($w:tt)* ) => {
#[$($attr)*]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct $Name < $($NameParam)* > ( $From ) where $($w)* ;
impl< $($NameParam)* > Iterator for $Name < $($NameParam)* > where $($w)* {
type Item = <$From as Iterator>::Item;
fn next(&mut self) -> Option<Self::Item> {
self.0.next()
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.0.size_hint()
}
}
}
}