Skip to content

Instantly share code, notes, and snippets.

@emk
Last active August 29, 2015 14:07
Show Gist options
  • Save emk/1162120f16432e12b10f to your computer and use it in GitHub Desktop.
Save emk/1162120f16432e12b10f to your computer and use it in GitHub Desktop.
Make this work, and StreamingIterator will be able to do a lot.
pub trait Nothing<'a> {
fn nothing(&'a mut self) -> ();
fn twice_nothing(&'a mut self) -> () {
{ self.nothing(); }
{ self.nothing(); }
}
}
// This works.
pub trait Nothing2 {
fn nothing(&mut self) -> ();
fn twice_nothing(&mut self) -> () {
{ self.nothing(); }
{ self.nothing(); }
}
}
// Here's the actual type we're working with. This was found via much trial and error.
pub trait StreamingIterator<'a, T> {
/// Return either the next item in the sequence, or `None` if all items
/// have been consumed.
fn next(&'a mut self) -> Option<T>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment