Types implementing this trait can be used to index the dictionary. Typical use-cases are: - PyObjectRef -> arbitrary python type used as key - str -> string reference used as key, this is often used internally
| 827 | /// - PyObjectRef -> arbitrary python type used as key |
| 828 | /// - str -> string reference used as key, this is often used internally |
| 829 | pub trait DictKey { |
| 830 | type Owned: ToPyObject; |
| 831 | fn _to_owned(&self, vm: &VirtualMachine) -> Self::Owned; |
| 832 | fn to_pyobject(&self, vm: &VirtualMachine) -> PyObjectRef { |
| 833 | self._to_owned(vm).to_pyobject(vm) |
| 834 | } |
| 835 | fn key_hash(&self, vm: &VirtualMachine) -> PyResult<HashValue>; |
| 836 | fn key_is(&self, other: &PyObject) -> bool; |
| 837 | fn key_eq(&self, vm: &VirtualMachine, other_key: &PyObject) -> PyResult<bool>; |
| 838 | fn key_as_isize(&self, vm: &VirtualMachine) -> PyResult<isize>; |
| 839 | } |
| 840 | |
| 841 | /// Implement trait for PyObjectRef such that we can use python objects |
| 842 | /// to index dictionaries. |
no outgoing calls
no test coverage detected