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

Method py_count

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

Source from the content-addressed store, hash-verified

267
268 #[inline]
269 fn py_count<F>(&self, needle: &Self, range: Range<usize>, count: F) -> usize
270 where
271 F: Fn(&Self, &Self) -> usize,
272 {
273 if range.is_normal() {
274 count(self.get_chars(range), needle)
275 } else {
276 0
277 }
278 }
279
280 fn py_pad(&self, left: usize, right: usize, fillchar: Self::Char) -> Self::Container {
281 let mut u = Self::Container::with_capacity(

Callers 2

countMethod · 0.80
countMethod · 0.80

Implementers 2

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

Calls 3

countFunction · 0.85
is_normalMethod · 0.45
get_charsMethod · 0.45

Tested by

no test coverage detected