Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8840f93

Browse files
committedJan 30, 2025·
Update encode_utf16 to mention it is native endian
1 parent e6f12c8 commit 8840f93

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎library/core/src/char/methods.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl char {
9292
#[stable(feature = "assoc_char_consts", since = "1.52.0")]
9393
pub const UNICODE_VERSION: (u8, u8, u8) = crate::unicode::UNICODE_VERSION;
9494

95-
/// Creates an iterator over the UTF-16 encoded code points in `iter`,
95+
/// Creates an iterator over the native endian UTF-16 encoded code points in `iter`,
9696
/// returning unpaired surrogates as `Err`s.
9797
///
9898
/// # Examples
@@ -704,7 +704,7 @@ impl char {
704704
unsafe { from_utf8_unchecked_mut(encode_utf8_raw(self as u32, dst)) }
705705
}
706706

707-
/// Encodes this character as UTF-16 into the provided `u16` buffer,
707+
/// Encodes this character as native endian UTF-16 into the provided `u16` buffer,
708708
/// and then returns the subslice of the buffer that contains the encoded character.
709709
///
710710
/// # Panics
@@ -1828,7 +1828,7 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] {
18281828
unsafe { slice::from_raw_parts_mut(dst.as_mut_ptr(), len) }
18291829
}
18301830

1831-
/// Encodes a raw `u32` value as UTF-16 into the provided `u16` buffer,
1831+
/// Encodes a raw `u32` value as native endian UTF-16 into the provided `u16` buffer,
18321832
/// and then returns the subslice of the buffer that contains the encoded character.
18331833
///
18341834
/// Unlike `char::encode_utf16`, this method also handles codepoints in the surrogate range.

‎library/core/src/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ impl str {
11081108
LinesAny(self.lines())
11091109
}
11101110

1111-
/// Returns an iterator of `u16` over the string encoded as UTF-16.
1111+
/// Returns an iterator of `u16` over the string encoded as native endian UTF-16.
11121112
///
11131113
/// # Examples
11141114
///

0 commit comments

Comments
 (0)
Please sign in to comment.