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

Method endswith

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

Source from the content-addressed store, hash-verified

365
366 #[pymethod]
367 fn endswith(&self, options: anystr::StartsEndsWithArgs, vm: &VirtualMachine) -> PyResult<bool> {
368 let borrowed = self.borrow_buf();
369 let (affix, substr) =
370 match options.prepare(&*borrowed, borrowed.len(), |s, r| s.get_bytes(r)) {
371 Some(x) => x,
372 None => return Ok(false),
373 };
374 substr.py_starts_ends_with(
375 &affix,
376 "endswith",
377 "bytes",
378 |s, x: PyBytesInner| s.ends_with(x.as_bytes()),
379 vm,
380 )
381 }
382
383 #[pymethod]
384 fn startswith(

Callers

nothing calls this directly

Calls 7

py_starts_ends_withMethod · 0.80
ends_withMethod · 0.80
borrow_bufMethod · 0.45
prepareMethod · 0.45
lenMethod · 0.45
get_bytesMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected