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

Method rstrip

crates/vm/src/builtins/bytes.rs:585–592  ·  view source on GitHub ↗
(self, chars: OptionalOption<PyBytesInner>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

583
584 #[pymethod]
585 fn rstrip(self, chars: OptionalOption<PyBytesInner>, vm: &VirtualMachine) -> Self {
586 let stripped = self.inner.rstrip(chars);
587 if stripped == self.as_bytes() {
588 self
589 } else {
590 vm.ctx.new_bytes(stripped.to_vec())
591 }
592 }
593
594 /// Return a string decoded from the given bytes.
595 /// Default encoding is 'utf-8'.

Callers

nothing calls this directly

Calls 3

to_vecMethod · 0.80
as_bytesMethod · 0.45
new_bytesMethod · 0.45

Tested by

no test coverage detected