Function widestring::encode_utf32

source ·
pub fn encode_utf32<I: IntoIterator<Item = char>>(
    iter: I,
) -> EncodeUtf32<I::IntoIter> 
Expand description

Creates an iterator that encodes an iterator over chars into UTF-32 u32 values.

This iterator is a simple type cast from char to u32, as any sequence of chars 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);