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

Method prepare

crates/vm/src/anystr.rs:58–73  ·  view source on GitHub ↗
(self, s: &S, len: usize, substr: F)

Source from the content-addressed store, hash-verified

56
57 #[inline]
58 pub fn prepare<S, F>(self, s: &S, len: usize, substr: F) -> Option<(PyObjectRef, &S)>
59 where
60 S: ?Sized + AnyStr,
61 F: Fn(&S, Range<usize>) -> &S,
62 {
63 let (affix, range) = self.get_value(len);
64 let substr = if let Some(range) = range {
65 if !range.is_normal() {
66 return None;
67 }
68 substr(s, range)
69 } else {
70 s
71 };
72 Some((affix, substr))
73 }
74}
75
76fn saturate_to_isize(py_int: PyIntRef) -> isize {

Callers 6

endswithMethod · 0.45
startswithMethod · 0.45
endswithMethod · 0.45
startswithMethod · 0.45
endswithMethod · 0.45
startswithMethod · 0.45

Calls 3

SomeClass · 0.50
get_valueMethod · 0.45
is_normalMethod · 0.45

Tested by

no test coverage detected