Function check_utf8_boundary

Source
pub fn check_utf8_boundary(slice: &Wtf8, index: usize)
Expand description

Verify that index is at the edge of either a valid UTF-8 codepoint (i.e. a codepoint that’s not a surrogate) or of the whole string.

These are the cases currently permitted by OsStr::slice_encoded_bytes. Splitting between surrogates is valid as far as WTF-8 is concerned, but we do not permit it in the public API because WTF-8 is considered an implementation detail.