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

Method getitem_by_index

crates/stdlib/src/mmap.rs:1473–1481  ·  view source on GitHub ↗
(&self, i: isize, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1471 }
1472
1473 fn getitem_by_index(&self, i: isize, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
1474 let i = i
1475 .wrapped_at(self.__len__())
1476 .ok_or_else(|| vm.new_index_error("mmap index out of range"))?;
1477
1478 let b = self.check_valid(vm)?.deref().as_ref().unwrap().as_slice()[i];
1479
1480 Ok(PyInt::from(b).into_ref(&vm.ctx).into())
1481 }
1482
1483 fn getitem_by_slice(
1484 &self,

Callers 3

getitem_innerMethod · 0.45
getitem_innerMethod · 0.45
subscriptMethod · 0.45

Calls 9

ok_or_elseMethod · 0.80
wrapped_atMethod · 0.80
check_validMethod · 0.80
__len__Method · 0.45
as_sliceMethod · 0.45
unwrapMethod · 0.45
as_refMethod · 0.45
derefMethod · 0.45
into_refMethod · 0.45

Tested by

no test coverage detected