Skip to content

Instantly share code, notes, and snippets.

@erickt
Created March 20, 2014 20:59
Show Gist options
  • Save erickt/9673666 to your computer and use it in GitHub Desktop.
Save erickt/9673666 to your computer and use it in GitHub Desktop.
trait IntoIterator<T, Iter: Iterator<T>> {
fn into_iterator(self) -> Iter;
}
impl<T, Iter: Iterator<T>> IntoIterator<T, Iter> for Iter {
fn into_iterator(self) -> Iter {
self
}
}
trait MoveIterable<T, Iter: Iterator<T>> {
fn move_iter(self) -> Iter;
}
impl<T, Iter: Iterator<T>, It: MoveIterable<T, Iter>> IntoIterator<T, Iter> for It {
fn into_iterator(self) -> Iter {
self.move_iter()
}
}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment