Created
April 26, 2016 01:59
-
-
Save Sgeo/8fd73763417fd03758a1e2812309d47a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Streamer<'a> { | |
type Item; | |
fn next(&'a mut self) -> Option<Self::Item>; | |
} | |
struct SelfStreaming; | |
impl<'a> Streamer<'a> for SelfStreaming { | |
type Item = &'a mut Self; | |
fn next(&'a mut self) -> Option<&'a mut Self> { | |
Some(self) | |
} | |
} | |
fn main() { | |
let mut foo = SelfStreaming; | |
let a = foo.next(); | |
foo.next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment