Published
- 1 min read
rust u8 to string
The solution for this is noted below
rust u8 to string
Solution
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();
Try other methods by searching on the site. That is if this doesn’t work