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

Method py_removesuffix

crates/vm/src/anystr.rs:357–366  ·  view source on GitHub ↗
(&self, suffix: &Self, suffix_len: usize, is_suffix: FC)

Source from the content-addressed store, hash-verified

355 }
356
357 fn py_removesuffix<FC>(&self, suffix: &Self, suffix_len: usize, is_suffix: FC) -> &Self
358 where
359 FC: Fn(&Self, &Self) -> bool,
360 {
361 if is_suffix(self, suffix) {
362 self.get_bytes(0..self.bytes_len() - suffix_len)
363 } else {
364 self
365 }
366 }
367
368 // TODO: remove this function from anystr.
369 // See https://github.com/RustPython/RustPython/pull/4709/files#r1141013993

Callers 2

removesuffixMethod · 0.80
removesuffixMethod · 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