Because r
is an array of u8
, you need to convert it to a valid &str
and use push_str
method of String
.
use std::str;
fn main() {
let rfrce = vec![&[65,66,67], &[68,69,70]];
let mut str = String::new();
for r in rfrce {
str.push_str(str::from_utf8(r).unwrap());
}
println!("{}", str);
}
3
solved Proper way to access Vec<&[u8]> as strings [duplicate]