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

Method py_removeprefix

crates/vm/src/anystr.rs:345–355  ·  view source on GitHub ↗
(&self, prefix: &Self, prefix_len: usize, is_prefix: FC)

Source from the content-addressed store, hash-verified

343 }
344
345 fn py_removeprefix<FC>(&self, prefix: &Self, prefix_len: usize, is_prefix: FC) -> &Self
346 where
347 FC: Fn(&Self, &Self) -> bool,
348 {
349 //if self.py_starts_with(prefix) {
350 if is_prefix(self, prefix) {
351 self.get_bytes(prefix_len..self.bytes_len())
352 } else {
353 self
354 }
355 }
356
357 fn py_removesuffix<FC>(&self, suffix: &Self, suffix_len: usize, is_suffix: FC) -> &Self
358 where

Callers 2

removeprefixMethod · 0.80
removeprefixMethod · 0.80

Implementers 2

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

Calls 2

get_bytesMethod · 0.45
bytes_lenMethod · 0.45

Tested by

no test coverage detected