decode_utf16 — UTF-16 시퀀스를 char로 디코딩하기
decode_utf16 — UTF-16 시퀀스를 char로 디코딩하기
decode_utf16는 u16 값들의 반복자를 받아 UTF-16 코드 유닛을 Unicode char로 디코딩하는 반복자로 바꿔 주는 함수예요.
출처: Rust 공식 문서
본문
pub fn decode_utf16<I>(iter: I) -> DecodeUtf16<<I as IntoIterator>::IntoIter>
where I: IntoIterator<Item = u16>,
서러게이트 페어(surrogate pair)를 올바르게 조합해 하나의 char를 만들어요. 잘못된 시퀀스는 std::char::DecodeUtf16Error로 표시돼요. char::decode_utf16 연관 함수가 안정화되면서 이 함수는 deprecated 될 예정이에요.