Function odds::char::encode_utf8 [] [src]

pub fn encode_utf8(ch: char, buf: &mut [u8]) -> Result<usize, EncodeUtf8Error>

Encode a char into buf using UTF-8.

On success, return the byte length of the encoding (1, 2, 3 or 4).
On error, return EncodeUtf8Error if the buffer was too short for the char.