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

Method try_mapping

crates/vm/src/protocol/mapping.rs:78–85  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

76 }
77
78 pub fn try_mapping(&self, vm: &VirtualMachine) -> PyResult<PyMapping<'_>> {
79 let mapping = self.mapping_unchecked();
80 if mapping.check() {
81 Ok(mapping)
82 } else {
83 Err(vm.new_type_error(format!("{} is not a mapping object", self.class())))
84 }
85 }
86}
87
88#[derive(Copy, Clone)]

Callers 3

try_from_objectMethod · 0.80
get_itemMethod · 0.80
get_sliceMethod · 0.80

Calls 3

mapping_uncheckedMethod · 0.80
ErrClass · 0.50
checkMethod · 0.45

Tested by

no test coverage detected