【发布时间】:2015-12-30 13:32:41
【问题描述】:
我无法使用std::iter::Peekable。为什么下面的代码不能编译?
// 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]
}
}
【问题讨论】:
标签: rust