Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Stream {
- type Output;
- fn next(&self) -> Option<Self::Output>;
- }
- struct Foo<'a, T: 'a>(&'a T);
- impl<'a, T: 'a> Stream for Foo<'a, T> {
- type Output = &'a T;
- fn next(&self) -> Option<Self::Output> {
- Some(&self.0)
- }
- }
- fn main() {
- let i = 123;
- let foo = Foo(&i);
- assert_eq!(foo.next(), Some(&123));
- }
Add Comment
Please, Sign In to add comment