widestringFunction encode_utf16
Source pub fn encode_utf16<I: IntoIterator<Item = char>>(
iter: I,
) -> EncodeUtf16<I::IntoIter> ⓘ
Expand description
Creates an iterator that encodes an iterator over char
s into UTF-16 u16
code units.
§Examples
use widestring::encode_utf16;
let encoded: Vec<u16> = encode_utf16("𝄞music".chars()).collect();
let v = [
0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063,
];
assert_eq!(encoded, v);