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

Method py_starts_ends_with

crates/vm/src/anystr.rs:201–227  ·  view source on GitHub ↗
(
        &self,
        affix: &'a PyObject,
        func_name: &str,
        py_type_name: &str,
        func: F,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

199
200 #[inline]
201 fn py_starts_ends_with<'a, T, F>(
202 &self,
203 affix: &'a PyObject,
204 func_name: &str,
205 py_type_name: &str,
206 func: F,
207 vm: &VirtualMachine,
208 ) -> PyResult<bool>
209 where
210 T: TryFromBorrowedObject<'a>,
211 F: Fn(&Self, T) -> bool,
212 {
213 single_or_tuple_any(
214 affix,
215 &|s: T| Ok(func(self, s)),
216 &|o| {
217 format!(
218 "{} first arg must be {} or a tuple of {}, not {}",
219 func_name,
220 py_type_name,
221 py_type_name,
222 o.class(),
223 )
224 },
225 vm,
226 )
227 }
228
229 #[inline]
230 fn py_strip<'a, S, FC, FD>(

Callers 6

endswithMethod · 0.80
startswithMethod · 0.80
endswithMethod · 0.80
startswithMethod · 0.80
endswithMethod · 0.80
startswithMethod · 0.80

Implementers 2

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

Calls 2

single_or_tuple_anyFunction · 0.85
funcFunction · 0.50

Tested by

no test coverage detected