Function widestring::encode_utf32
source · [−]pub fn encode_utf32<I: IntoIterator<Item = char>>(
iter: I
) -> EncodeUtf32<I::IntoIter>ⓘNotable traits for EncodeUtf32<I>impl<I> Iterator for EncodeUtf32<I> where
I: Iterator<Item = char>, type Item = u32;
Expand description
Creates an iterator that encodes an iterator over char
s into UTF-32 u32
values.
This iterator is a simple type cast from char
to u32
, as any sequence of char
s is
valid UTF-32.
Examples
use widestring::encode_utf32;
let encoded: Vec<u32> = encode_utf32("𝄞music".chars()).collect();
let v = [
0x1D11E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063,
];
assert_eq!(encoded, v);