pub fn string_to_bytes(s: &str) -> Vec<u8> ⓘExpand description
Converts a string to its byte representation.
This function takes a string slice and returns a vector of bytes containing its UTF-8 representation.
§Arguments
s- A string slice to convert to bytes.
§Returns
A Vec
§Example
let string = "Hello";
let bytes = byteutils::string_to_bytes(string);
assert_eq!(bytes, vec![72, 101, 108, 108, 111]);