Skip to main content

patch_seq_map_set

Function patch_seq_map_set 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_map_set(stack: Stack) -> Stack
Expand description

Set a key-value pair in the map with COW optimization.

Stack effect: ( Map key value – Map )

Fast path: if the map (at sp-3) is sole-owned, pops key and value, inserts directly into the map in place — no Box alloc/dealloc cycle. Slow path: pops all three, clones the map, inserts, pushes new map.

§Safety

Stack must have value on top, key below, and Map at third position