删除mut_iter后,在夜间构建中创建可变迭代器

时间:2014-12-09 19:58:05

标签: rust

我下载了Rust的每晚版本并尝试构建我的代码,但有趣的是我意识到mut_iter()已不复存在。删除为字符串创建可变迭代器的能力的原因是什么?我有这个功能:

//invert hex picture, this is used in the print_bitmap function
//  to save space and break apart one large code base.
pub fn invert_ascii_hex_string(line: &mut [std::ascii::Ascii]) {
  for c in line.mut_iter() {
    *c = match c.to_char() {
      'x' => ' ',
       _  => 'x'
    }.to_ascii();
  }
}

现在我不确定如何在没有可变迭代器的情况下完成此任务。我现在可以使用什么来迭代列表并更改每个值?

1 个答案:

答案 0 :(得分:6)

尝试使用iter_mut()代替mut_iter()