#![allow(unused_variables)] #![feature(str_from_utf16_endian)] fn main() { let v = &[ 0xD8, 0x34, 0xDD, 0x1E, 0x00, 0x6d, 0x00, 0x75, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, ]; assert_eq!(String::from("𝄞music"), String::from_utf16be(v).unwrap()); let v = &[ 0xD8, 0x34, 0xDD, 0x1E, 0x00, 0x6d, 0x00, 0x75, 0xD8, 0x00, 0x00, 0x69, 0x00, 0x63, ]; assert!(String::from_utf16be(v).is_err()); }