Skip to main content

Module mutable_ops

Module mutable_ops 

Source
Expand description

Shared implementations of the mutable-array accessors.

Both the stdlib natives (sema-stdlib/src/mutable.rs) and the VM’s MutArrGet / MutArrSet intrinsic opcodes (sema-vm/src/vm.rs) dispatch into these, so the two paths raise byte-identical errors and can never drift apart semantically.

Functions§

mutable_array_get
mutable-array/get: indexed read. default is the optional third argument — returned on an out-of-bounds index instead of erroring. Type and index errors are raised regardless of the default.
mutable_array_set
mutable-array/set!: indexed write into an existing slot. Takes val by move so a caller that owns the value (the VM’s MutArrSet arm) pays no clone. The Sema-level contract returns the array itself — the caller hands back its own array handle after Ok(()).