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

Method insert

crates/vm/src/builtins/list.rs:195–199  ·  view source on GitHub ↗
(&self, position: isize, element: PyObjectRef)

Source from the content-addressed store, hash-verified

193
194 #[pymethod]
195 pub(crate) fn insert(&self, position: isize, element: PyObjectRef) {
196 let mut elements = self.borrow_vec_mut();
197 let position = elements.saturate_index(position);
198 elements.insert(position, element);
199 }
200
201 fn concat(&self, other: &PyObject, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
202 let other = other.downcast_ref::<Self>().ok_or_else(|| {

Callers 15

prepend_argMethod · 0.45
from_argsMethod · 0.45
merge_objectMethod · 0.45
merge_dictMethod · 0.45
inner_setitemMethod · 0.45
from_attributesMethod · 0.45
updateMethod · 0.45
to_attributesMethod · 0.45
vectorcall_bound_methodFunction · 0.45
addMethod · 0.45
resolve_mroMethod · 0.45
new_heap_innerMethod · 0.45

Calls 2

borrow_vec_mutMethod · 0.80
saturate_indexMethod · 0.80

Tested by

no test coverage detected