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

Method _to_char_idx

crates/vm/src/builtins/str.rs:1177–1179  ·  view source on GitHub ↗
(r: &Wtf8, byte_idx: usize)

Source from the content-addressed store, hash-verified

1175 // FIXME: two traversals of str is expensive
1176 #[inline]
1177 fn _to_char_idx(r: &Wtf8, byte_idx: usize) -> usize {
1178 r[..byte_idx].code_points().count()
1179 }
1180
1181 #[inline]
1182 fn _find<F>(&self, args: FindArgs, find: F) -> Option<usize>

Callers

nothing calls this directly

Calls 2

code_pointsMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected