Skip to content

Instantly share code, notes, and snippets.

@hyunsik
Created October 13, 2015 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyunsik/d4a8743bf6b5bf1ea7a4 to your computer and use it in GitHub Desktop.
Save hyunsik/d4a8743bf6b5bf1ea7a4 to your computer and use it in GitHub Desktop.
Skeleton Code for Rust Iterator
pub struct TaskSet;
pub struct TaskSetIterator {
...
}
impl Iterator for TaskSetIterator {
type Item = Task;
fn next(&mut self) -> Option<Task> {
....
}
}
pub struct Task;
impl IntoIterator for TaskSet {
type Item = Task;
type IntoIter = TaskSetIterator;
fn into_iter(self) -> Self::IntoIter {
TaskSetIterator { ... }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment