Function std::char::encode_utf16_raw
source · pub fn encode_utf16_raw(code: u32, dst: &mut [u16]) -> &mut [u16]🔬This is a nightly-only experimental API. (
char_internals)Expand description
Encodes a raw u32 value as UTF-16 into the provided u16 buffer,
and then returns the subslice of the buffer that contains the encoded character.
Unlike char::encode_utf16, this method also handles codepoints in the surrogate range.
(Creating a char in the surrogate range is UB.)
Panics
Panics if the buffer is not large enough.
A buffer of length 2 is large enough to encode any char.