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

Method index

crates/vm/src/builtins/str.rs:1203–1206  ·  view source on GitHub ↗
(&self, args: FindArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1201
1202 #[pymethod]
1203 fn index(&self, args: FindArgs, vm: &VirtualMachine) -> PyResult<usize> {
1204 self._find(args, |r, s| Some(Self::_to_char_idx(r, r.find(s)?)))
1205 .ok_or_else(|| vm.new_value_error("substring not found"))
1206 }
1207
1208 #[pymethod]
1209 fn rindex(&self, args: FindArgs, vm: &VirtualMachine) -> PyResult<usize> {

Callers

nothing calls this directly

Calls 4

ok_or_elseMethod · 0.80
SomeClass · 0.50
_findMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected