📜  rust u8 to string - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.554000             🧑  作者: Mango

代码示例1
use std::str;

// some bytes, in a vector
let sparkle_heart = vec![240, 159, 146, 150];

// We know these bytes are valid, so just use `unwrap()`.
let sparkle_heart = str::from_utf8(&sparkle_heart).unwrap();