Skip to main content

serialize_code_with

Function serialize_code_with 

Source
pub fn serialize_code_with<W, C, E>(
    buf: &mut W,
    code: &CodeObject<C>,
    write_constant: impl FnMut(&mut W, &C) -> Result<(), E>,
) -> Result<(), E>
where W: Write, C: Constant,
Expand description

Serialize a code object, writing each co_consts entry through write_constant.

A runtime caller passes its own object writer so that values its constant representation carries but BorrowedConstant cannot describe — lists, dicts, sets — reach the stream, and so a constant shared with the enclosing object keeps its entry in that writer’s reference table.