Skip to main content

Module encode

Module encode 

Source
Expand description

Swift encoding expression/statement generation.

Generates Swift code that encodes values into an inout ByteBuffer. All encode functions are void — they append into the buffer rather than returning a new [UInt8].

Functions§

generate_encode_closure
Generate a Swift encode closure (T, inout ByteBuffer) -> Void for use with encodeVec, encodeOption, etc.
generate_encode_stmt
Generate a Swift encode statement for a given shape and value. The statement appends into the implicit buffer: inout ByteBuffer in scope.
generate_named_type_encode_fn
Generate a top-level Swift encode function for a named struct or enum. e.g. internal func encodeGnarlyPayload(_ value: GnarlyPayload, into buffer: inout ByteBuffer)
generate_named_type_encode_fns
Generate encode functions for all named types.
named_type_encode_fn_name
The name of the generated encode function for a named type.
swift_encode_fn
Get the Swift encode function name for a scalar type.