Skip to main content

read_capture_as_value_bits

Function read_capture_as_value_bits 

Source
pub unsafe fn read_capture_as_value_bits(
    ptr: *const u8,
    layout: &ClosureLayout,
    idx: usize,
) -> u64
Expand description

Read a capture slot as a typed u64 bit pattern suitable for ValueWord::from_raw_bits.

The read width is dictated by the capture’s FieldKind: narrower integer kinds are sign/zero-extended to i64; Bool reads a single byte; Ptr / I64 / U64 reads 8 bytes verbatim; F64 reads an f64 and re-encodes via ValueWord::from_f64 so that the returned bits are always NaN-box-decodable.

§Safety

ptr must point to a live TypedClosureHeader block whose layout matches the layout argument and has at least idx + 1 captures.