Fast lookup using a cached entry index hint.
(
&self,
key: &K,
hint: u16,
vm: &VirtualMachine,
)
| 690 | |
| 691 | /// Fast lookup using a cached entry index hint. |
| 692 | pub(crate) fn get_item_opt_hint<K: DictKey + ?Sized>( |
| 693 | &self, |
| 694 | key: &K, |
| 695 | hint: u16, |
| 696 | vm: &VirtualMachine, |
| 697 | ) -> PyResult<Option<PyObjectRef>> { |
| 698 | if self.exact_dict(vm) { |
| 699 | self.entries.get_hint(vm, key, usize::from(hint)) |
| 700 | } else { |
| 701 | self.get_item_opt(key, vm) |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | pub fn get_item<K: DictKey + ?Sized>(&self, key: &K, vm: &VirtualMachine) -> PyResult { |
| 706 | if self.exact_dict(vm) { |
no test coverage detected