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

Function insort_left

crates/stdlib/src/bisect.rs:111–128  ·  view source on GitHub ↗
(BisectArgs { a, x, lo, hi, key }: BisectArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

109
110 #[pyfunction]
111 fn insort_left(BisectArgs { a, x, lo, hi, key }: BisectArgs, vm: &VirtualMachine) -> PyResult {
112 let x = if let Some(ref key) = key {
113 key.call((x,), vm)?
114 } else {
115 x
116 };
117 let index = bisect_left(
118 BisectArgs {
119 a: a.clone(),
120 x: x.clone(),
121 lo,
122 hi,
123 key,
124 },
125 vm,
126 )?;
127 vm.call_method(&a, "insert", (index, x))
128 }
129
130 #[pyfunction]
131 fn insort_right(BisectArgs { a, x, lo, hi, key }: BisectArgs, vm: &VirtualMachine) -> PyResult {

Callers

nothing calls this directly

Calls 4

bisect_leftFunction · 0.70
callMethod · 0.45
cloneMethod · 0.45
call_methodMethod · 0.45

Tested by

no test coverage detected