Skip to main content

Module decode

Module decode 

Source
Expand description

Swift decoding statement generation.

Generates Swift code that decodes values from an inout ByteBuffer. All decode functions take inout ByteBuffer and advance its reader index.

Functions§

generate_decode_closure
Generate a Swift decode closure (inout ByteBuffer) throws -> T for use with decodeVec, decodeOption, etc.
generate_decode_stmt
Generate a Swift decode statement for a given shape. Returns code that decodes from buffer into a variable named var_name.
generate_decode_stmt_from
Generate a Swift decode statement from a specific data variable. (data_var is now ignored — kept for call-site compatibility, buffer is always buffer)
generate_decode_stmt_from_with_cursor
Generate a Swift decode statement from a specific data variable and cursor. (data_var and cursor_var are now ignored — kept for call-site compatibility)
generate_decode_stmt_with_buf
Core implementation: generate a decode statement that reads from the named buffer variable.
generate_decode_stmt_with_cursor
Generate a Swift decode statement for a given shape using a custom cursor variable name. (cursor_var is now ignored — kept for call-site compatibility, buffer is always buffer)
generate_inline_decode
Generate inline decode expression — just the expression part, no let x =. Used internally where a closure calls another closure.
generate_named_type_decode_fn
Generate a top-level decode<Name>(from:) function for a named struct or enum.
generate_named_type_decode_fns
Generate decode functions for every named type.
named_type_decode_fn_name
The name of the generated decode function for a named type.
swift_decode_fn
Get the Swift decode function name for a scalar type.