Answers for "rust string to byte string"

1

rust string from bytes

String::from_utf8_lossy(&[u8]) -> Cow<'_, str>

Basically

let x: &str = &String::from_utf8_lossy(&[1, 7, 4, 32, 69]);
Posted by: Guest on September-07-2021
0

string to bytes rust

&str.as_bytes()
Posted by: Guest on July-31-2021

Browse Popular Code Answers by Language