I have trouble using a std::iter::Peekable
. Why does the following code does not compile?
// rustc 1.7.0-nightly (b4707ebca 2015-12-27)
use std::iter::*;
struct Foo<'a> {
chars: Peekable<Chars<'a>>,
}
impl<'a> Foo<'a> {
fn foo(&mut self) {
self.chars.next(); // Ok
self.chars.skip_while(|c| true); // error: cannot move out of borrowed content [E0507]
}
}