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

Method nth_char

crates/common/src/str.rs:322–328  ·  view source on GitHub ↗
(&self, index: usize)

Source from the content-addressed store, hash-verified

320 }
321
322 pub fn nth_char(&self, index: usize) -> CodePoint {
323 match self.as_str_kind() {
324 PyKindStr::Ascii(s) => s[index].into(),
325 PyKindStr::Utf8(s) => s.chars().nth(index).unwrap().into(),
326 PyKindStr::Wtf8(w) => w.code_points().nth(index).unwrap(),
327 }
328 }
329}
330
331impl core::fmt::Display for StrData {

Callers 1

do_getMethod · 0.80

Calls 4

charsMethod · 0.80
code_pointsMethod · 0.80
as_str_kindMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected