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

Method get_item_opt_hint

crates/vm/src/builtins/dict.rs:692–703  ·  view source on GitHub ↗

Fast lookup using a cached entry index hint.

(
        &self,
        key: &K,
        hint: u16,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

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) {

Callers 1

execute_instructionMethod · 0.80

Calls 3

exact_dictMethod · 0.80
get_hintMethod · 0.80
get_item_optMethod · 0.80

Tested by

no test coverage detected