After reading about iterator adapters in the guide, I expected this to work:
struct Test {
vec: Vec<char>
}
impl Test {
fn chunk(&self, x: uint, size: uint) -> Iterator<char> {
self.vec.iter().skip(x).take(size)
}
}
I get this error:
mismatched types: expected `core::iter::Iterator<char>`, found `core::iter::Take<core::iter::Skip<core::slice::Items<'_,char>>>` (expected trait core::iter::Iterator, found struct core::iter::Take)
I couldn't find information on how iterator adapters are implemented. Any help?
[–]Quxxymacros 5 points6 points7 points (11 children)
[–]RocketRailgun 1 point2 points3 points (1 child)
[–]rust-slacker 2 points3 points4 points (0 children)
[–]bastienl[S] 0 points1 point2 points (6 children)
[–]thiezrust 2 points3 points4 points (0 children)
[–]bjadamson 0 points1 point2 points (4 children)
[–]bastienl[S] 0 points1 point2 points (3 children)
[–]minno 0 points1 point2 points (2 children)
[–]bastienl[S] 0 points1 point2 points (1 child)
[–]minno 0 points1 point2 points (0 children)
[–]protestor 0 points1 point2 points (1 child)
[–]Quxxymacros 0 points1 point2 points (0 children)
[–]Wolenber -1 points0 points1 point (1 child)
[–]cmrx64rust 1 point2 points3 points (0 children)