Skip to content

Commit a637252

Browse files
author
Sky
committed
Clarify the possible return values of len_utf16
1 parent b8c35ca commit a637252

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/char/methods.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,14 @@ impl char {
597597
/// Returns the number of 16-bit code units this `char` would need if
598598
/// encoded in UTF-16.
599599
///
600+
/// That number of code units is always either 1 or 2, for unicode scalar values in
601+
/// the [basic multilingual plane] or [supplementary planes] respectively.
602+
///
600603
/// See the documentation for [`len_utf8()`] for more explanation of this
601604
/// concept. This function is a mirror, but for UTF-16 instead of UTF-8.
602605
///
606+
/// [basic multilingual plane]: http://www.unicode.org/glossary/#basic_multilingual_plane
607+
/// [supplementary planes]: http://www.unicode.org/glossary/#supplementary_planes
603608
/// [`len_utf8()`]: #method.len_utf8
604609
///
605610
/// # Examples

0 commit comments

Comments
 (0)