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

Method cmp

crates/vm/src/builtins/memory.rs:1075–1093  ·  view source on GitHub ↗
(
        zelf: &Py<Self>,
        other: &PyObject,
        op: PyComparisonOp,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

1073
1074impl Comparable for PyMemoryView {
1075 fn cmp(
1076 zelf: &Py<Self>,
1077 other: &PyObject,
1078 op: PyComparisonOp,
1079 vm: &VirtualMachine,
1080 ) -> PyResult<PyComparisonValue> {
1081 match op {
1082 PyComparisonOp::Ne => {
1083 Self::eq(zelf, other, vm).map(|x| PyComparisonValue::Implemented(!x))
1084 }
1085 PyComparisonOp::Eq => Self::eq(zelf, other, vm).map(PyComparisonValue::Implemented),
1086 _ => Err(vm.new_type_error(format!(
1087 "'{}' not supported between instances of '{}' and '{}'",
1088 op.operator_token(),
1089 zelf.class().name(),
1090 other.class().name()
1091 ))),
1092 }
1093 }
1094}
1095
1096impl Hashable for PyMemoryView {

Callers 1

pos_from_multi_indexMethod · 0.45

Calls 3

eqFunction · 0.50
ErrClass · 0.50
mapMethod · 0.45

Tested by

no test coverage detected