@ -9,6 +9,13 @@ pub fn array_to_utf8<const X: usize>(array: [u8; X]) -> Result<String, std::stri
})
}
pub fn array_to_utf16(array: &[u8]) -> String {
unsafe {
let (_, data, _) = array.align_to();
String::from_utf16_lossy(&data).trim_matches(char::from(0)).into()
// TODO: const fn version of this! (helpful with tests)
#[macro_export]