MCPcopy Index your code
hub / github.com/RustPython/RustPython / is_code_point_boundary

Function is_code_point_boundary

crates/wtf8/src/lib.rs:1289–1297  ·  view source on GitHub ↗
(slice: &Wtf8, index: usize)

Source from the content-addressed store, hash-verified

1287/// Copied from str::is_char_boundary
1288#[inline]
1289fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool {
1290 if index == 0 {
1291 return true;
1292 }
1293 match slice.bytes.get(index) {
1294 None => index == slice.len(),
1295 Some(&b) => (b as i8) >= -0x40,
1296 }
1297}
1298
1299/// Verify that `index` is at the edge of either a valid UTF-8 codepoint
1300/// (i.e. a codepoint that's not a surrogate) or of the whole string.

Callers 3

getMethod · 0.85
indexMethod · 0.85

Calls 2

getMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected