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

Function codepoint_range_end

crates/common/src/str.rs:402–411  ·  view source on GitHub ↗
(s: &Wtf8, n_chars: usize)

Source from the content-addressed store, hash-verified

400
401#[inline]
402pub fn codepoint_range_end(s: &Wtf8, n_chars: usize) -> Option<usize> {
403 let i = match n_chars.checked_sub(1) {
404 Some(last_char_index) => {
405 let (index, c) = s.code_point_indices().nth(last_char_index)?;
406 index + c.len_wtf8()
407 }
408 None => 0,
409 };
410 Some(i)
411}
412
413pub fn zfill(bytes: &[u8], width: usize) -> Vec<u8> {
414 if width <= bytes.len() {

Callers 2

try_get_codepointsFunction · 0.85
readlineMethod · 0.85

Calls 3

code_point_indicesMethod · 0.80
len_wtf8Method · 0.80
SomeClass · 0.50

Tested by

no test coverage detected