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

Method py_find

crates/vm/src/anystr.rs:255–266  ·  view source on GitHub ↗
(&self, needle: &Self, range: Range<usize>, find: F)

Source from the content-addressed store, hash-verified

253
254 #[inline]
255 fn py_find<F>(&self, needle: &Self, range: Range<usize>, find: F) -> Option<usize>
256 where
257 F: Fn(&Self, &Self) -> Option<usize>,
258 {
259 if range.is_normal() {
260 let start = range.start;
261 let index = find(self.get_chars(range), needle)?;
262 Some(start + index)
263 } else {
264 None
265 }
266 }
267
268 #[inline]
269 fn py_count<F>(&self, needle: &Self, range: Range<usize>, count: F) -> usize

Callers 2

findMethod · 0.80
_findMethod · 0.80

Implementers 2

bytes_inner.rscrates/vm/src/bytes_inner.rs
str.rscrates/vm/src/builtins/str.rs

Calls 4

findFunction · 0.50
SomeClass · 0.50
is_normalMethod · 0.45
get_charsMethod · 0.45

Tested by

no test coverage detected