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

Method startswith

crates/vm/src/builtins/str.rs:913–930  ·  view source on GitHub ↗
(
        &self,
        options: anystr::StartsEndsWithArgs,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

911
912 #[pymethod]
913 fn startswith(
914 &self,
915 options: anystr::StartsEndsWithArgs,
916 vm: &VirtualMachine,
917 ) -> PyResult<bool> {
918 let (affix, substr) =
919 match options.prepare(self.as_wtf8(), self.len(), |s, r| s.get_chars(r)) {
920 Some(x) => x,
921 None => return Ok(false),
922 };
923 substr.py_starts_ends_with(
924 &affix,
925 "startswith",
926 "str",
927 |s, x: &Py<Self>| s.starts_with(x.as_wtf8()),
928 vm,
929 )
930 }
931
932 #[pymethod]
933 fn removeprefix(&self, pref: PyStrRef) -> Wtf8Buf {

Callers 14

remove_prefixFunction · 0.45
parse_requirementFunction · 0.45
find_doc_entriesFunction · 0.45
_slotnamesFunction · 0.45
__getattribute__Method · 0.45
__setattr__Method · 0.45
__delattr__Method · 0.45
_make_relax_caseFunction · 0.45
_path_joinFunction · 0.45
_path_isabsFunction · 0.45
source_from_cacheFunction · 0.45
_fill_cacheMethod · 0.45

Calls 6

py_starts_ends_withMethod · 0.80
starts_withMethod · 0.80
prepareMethod · 0.45
as_wtf8Method · 0.45
lenMethod · 0.45
get_charsMethod · 0.45

Tested by

no test coverage detected