I have a byte array which I would like to return as std::string::String
. The other answers and docs I found were converting Vectors to strings.
How would I convert a byte array &[u8]
to a String
?
I have a byte array which I would like to return as std::string::String
. The other answers and docs I found were converting Vectors to strings.
How would I convert a byte array &[u8]
to a String
?
It's working with std::str::from_utf8
:
std::str::from_utf8(byte_array).unwrap().to_string();