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

Method rsplit

crates/vm/src/bytes_inner.rs:670–689  ·  view source on GitHub ↗
(
        &self,
        options: ByteInnerSplitOptions,
        convert: F,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

668 }
669
670 pub fn rsplit<F>(
671 &self,
672 options: ByteInnerSplitOptions,
673 convert: F,
674 vm: &VirtualMachine,
675 ) -> PyResult<Vec<PyObjectRef>>
676 where
677 F: Fn(&[u8], &VirtualMachine) -> PyObjectRef,
678 {
679 let mut elements = self.elements.py_split(
680 options,
681 vm,
682 || convert(&self.elements, vm),
683 |v, s, vm| v.rsplit_str(s).map(|v| convert(v, vm)).collect(),
684 |v, s, n, vm| v.rsplitn_str(n, s).map(|v| convert(v, vm)).collect(),
685 |v, n, vm| v.py_rsplit_whitespace(n, |v| convert(v, vm)),
686 )?;
687 elements.reverse();
688 Ok(elements)
689 }
690
691 pub fn partition(&self, sub: &Self, vm: &VirtualMachine) -> PyResult<(Vec<u8>, bool, Vec<u8>)> {
692 self.elements.py_partition(

Callers 3

source_from_cacheFunction · 0.45
is_packageMethod · 0.45
_resolve_nameFunction · 0.45

Calls 6

py_splitMethod · 0.80
collectMethod · 0.80
convertFunction · 0.50
mapMethod · 0.45
py_rsplit_whitespaceMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected