Skip to content

Instantly share code, notes, and snippets.

@hyunsik

hyunsik/task2.rs

Last active Oct 13, 2015
Embed
What would you like to do?
A skeleton code for Rust Iterator that does not consume items
pub struct TaskSetRefIterator<'a>
{
....
}
impl<'a> Iterator for TaskSetRefIterator<'a> {
type Item = &'a Task;
fn next(&mut self) -> Option<&'a Task> {
None
}
}
impl<'a> IntoIterator for &'a TaskSet {
type Item = &'a Task;
type IntoIter = TaskSetRefIterator<'a>;
fn into_iter(self) -> Self::IntoIter {
TaskSetRefIterator { ... }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.