>>93
こんな感じかな。

buf = buf.replace(ch, &<String as std::iter::FromIterator<&char>>::from_iter(&[' ', ch, ' ']));