Skip to main content

write_capture_raw_u64

Function write_capture_raw_u64 

Source
pub unsafe fn write_capture_raw_u64(
    ptr: *mut u8,
    layout: &ClosureLayout,
    idx: usize,
    bits: u64,
)
Expand description

Write a raw 8-byte capture slot at the given index.

The caller is responsible for encoding the value in the format the consumer (JIT-inlined closure body, VM dispatch, or jit_finalize_heap_closure) expects — typically the raw ValueWord bit pattern (ValueWord::into_raw_bits) for Ptr/I64/U64 kinds, native little-endian for narrower numeric kinds, 0/1 byte for Bool. write_capture_typed provides a higher-level wrapper.

§Safety

  • ptr must point to a live TypedClosureHeader block whose layout has at least idx + 1 captures.
  • The 8-byte write at heap_capture_offset(idx) is always in-bounds because the layout rounds total size up to 8-byte alignment.