rust/library/core/src
Dylan DPC 25acd9331e
Rollup merge of #94713 - clarfonthey:is_char_surrogate, r=scottmcm
Add u16::is_utf16_surrogate

Right now, there are methods in the standard library for encoding and decoding UTF-16, but at least for the moment, there aren't any methods specifically for `u16` to help work with UTF-16 data. Since the full logic already exists, this wouldn't really add any code, just expose what's already there.

This method in particular is useful for working with the data returned by Windows `OsStrExt::encode_wide`. Initially, I was planning to also offer a `TryFrom<u16> for char`, but decided against it for now. There is plenty of code in rustc that could be rewritten to use this method, but I only checked within the standard library to replace them.

I think that offering more UTF-16-related methods to u16 would be useful, but I think this one is a good start. For example, one useful method might be `u16::is_pattern_whitespace`, which would check if something is the Unicode `Pattern_Whitespace` category. We can get away with this because all of the `Pattern_Whitespace` characters are in the basic multilingual plane, and hence we don't need to check for surrogates.
2022-03-23 03:05:31 +01:00
..
alloc Fix a bunch of typos 2021-12-14 16:40:43 +01:00
array Rollup merge of #94657 - fee1-dead:const_slice_index, r=oli-obk 2022-03-10 12:20:52 +01:00
async_iter Add Stream alias for AsyncIterator 2022-03-15 20:59:13 -07:00
char Add u16::is_utf16_surrogate 2022-03-21 22:51:32 -04:00
convert Rollup merge of #95110 - wmstack:patch-1, r=Dylan-DPC 2022-03-20 09:15:01 +01:00
ffi merge the char signess list of archs with freebsd as it is the same 2022-03-02 12:12:28 +00:00
fmt Auto merge of #95107 - r00ster91:fmt, r=joshtriplett 2022-03-22 08:47:16 +00:00
future Rename IntoFuture::Future to IntoFuture::IntoFuture 2022-03-10 20:51:52 +01:00
hash change PhantomData type for BuildHasherDefault 2022-01-07 00:39:48 +01:00
iter add perf side effect docs to Iterator::cloned() 2022-03-22 19:07:23 +01:00
macros Format core and std macro rules, removing needless surrounding blocks 2022-03-11 15:26:51 -08:00
mem Add #![allow(unexpected_cfgs)] in preparation of global --check-cfg 2022-03-04 11:34:51 +01:00
num Add u16::is_utf16_surrogate 2022-03-21 22:51:32 -04:00
ops Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
panic Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
prelude update cfg(bootstrap)s 2022-01-28 15:01:07 +01:00
ptr Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
slice Use reduce_sum in as_simd example 2022-03-12 16:43:38 -08:00
str Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
sync Rollup merge of #94816 - WaffleLapkin:atomic_get_mut_slice, r=Mark-Simulacrum 2022-03-13 20:02:00 +01:00
task Rollup merge of #89869 - kpreid:from-doc, r=yaahc 2022-02-17 06:29:57 +01:00
unicode
any.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
ascii.rs Inline <EscapeDefault as Iterator>::next 2022-03-10 15:35:22 +01:00
bool.rs Constify bool::then{,_some} 2021-12-15 00:11:23 +08:00
borrow.rs Make Borrow and BorrowMut impls const 2021-12-04 21:57:39 +09:00
cell.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
clone.rs Make some Clone impls const 2021-12-12 04:19:23 +09:00
cmp.rs Derive Eq for std::cmp::Ordering, instead of using manual impl. 2022-03-16 11:36:31 -05:00
default.rs
hint.rs Add core::hint::must_use 2022-03-08 10:58:03 -08:00
internal_macros.rs Add a copy of cfg_if to core's internal_macros.rs 2022-03-01 16:24:10 -08:00
intrinsics.rs Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
lazy.rs Rollup merge of #89869 - kpreid:from-doc, r=yaahc 2022-02-17 06:29:57 +01:00
lib.rs Add u16::is_utf16_surrogate 2022-03-21 22:51:32 -04:00
marker.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
option.rs Document that Option<extern "abi" fn> discriminant elision applies for any ABI 2022-03-18 18:14:34 +01:00
panic.rs resolve the conflict in compiler/rustc_session/src/parse.rs 2022-03-16 20:12:30 +08:00
panicking.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
pin.rs fix pin doc typo 2022-03-06 21:40:30 +08:00
primitive_docs.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
primitive.rs
result.rs Rollup merge of #94765 - m-ou-se:is-some-and, r=Dylan-DPC 2022-03-11 03:32:04 +01:00
time.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
tuple.rs
unit.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00