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

Method insert

crates/vm/src/builtins/bytearray.rs:587–593  ·  view source on GitHub ↗
(&self, index: isize, object: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

585
586 #[pymethod]
587 fn insert(&self, index: isize, object: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
588 let value = value_from_object(vm, &object)?;
589 let elements = &mut self.try_resizable(vm)?.elements;
590 let index = elements.saturate_index(index);
591 elements.insert(index, value);
592 Ok(())
593 }
594
595 #[pymethod]
596 fn append(&self, object: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 3

value_from_objectFunction · 0.85
try_resizableMethod · 0.80
saturate_indexMethod · 0.80

Tested by

no test coverage detected