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

Method cmp

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

Source from the content-addressed store, hash-verified

643
644impl Comparable for PyInt {
645 fn cmp(
646 zelf: &Py<Self>,
647 other: &PyObject,
648 op: PyComparisonOp,
649 _vm: &VirtualMachine,
650 ) -> PyResult<PyComparisonValue> {
651 let r = other
652 .downcast_ref::<Self>()
653 .map(|other| op.eval_ord(zelf.value.cmp(&other.value)));
654 Ok(PyComparisonValue::from_option(r))
655 }
656}
657
658impl Representable for PyInt {

Callers

nothing calls this directly

Calls 2

eval_ordMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected