1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::marker::PhantomData;
use {Source, Value};
pub struct Sequence<'l, S: ?Sized, V> where S: Source + 'l, V: Value + 'l {
source: &'l mut S,
phantom: PhantomData<&'l V>,
}
impl<'l, S, V> From<&'l mut S> for Sequence<'l, S, V> where S: Source, V: Value {
#[inline(always)]
fn from(source: &'l mut S) -> Self {
Sequence { source: source, phantom: PhantomData }
}
}
impl<'l, S, V> Iterator for Sequence<'l, S, V> where S: Source, V: Value {
type Item = V;
#[inline(always)]
fn next(&mut self) -> Option<V> {
Some(self.source.read())
}
}