Function widestring::encode_utf8

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

Creates an iterator that encodes an iterator over chars into UTF-8 bytes.

§Examples

use widestring::encode_utf8;

let music = "𝄞music";

let encoded: Vec<u8> = encode_utf8(music.chars()).collect();

assert_eq!(encoded, music.as_bytes());