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

Method endswith

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

Source from the content-addressed store, hash-verified

895
896 #[pymethod]
897 fn endswith(&self, options: anystr::StartsEndsWithArgs, vm: &VirtualMachine) -> PyResult<bool> {
898 let (affix, substr) =
899 match options.prepare(self.as_wtf8(), self.len(), |s, r| s.get_chars(r)) {
900 Some(x) => x,
901 None => return Ok(false),
902 };
903 substr.py_starts_ends_with(
904 &affix,
905 "endswith",
906 "str",
907 |s, x: &Py<Self>| s.ends_with(x.as_wtf8()),
908 vm,
909 )
910 }
911
912 #[pymethod]
913 fn startswith(

Callers 8

_slotnamesFunction · 0.45
readlineMethod · 0.45
_path_joinFunction · 0.45
_path_isabsFunction · 0.45
_get_cachedFunction · 0.45
spec_from_file_locationFunction · 0.45
find_specMethod · 0.45
create_moduleMethod · 0.45

Calls 6

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

Tested by

no test coverage detected