aztec-nr - noir_aztec::protocol::meta::utils

Function derive_serialization_quotes

pub comptime fn derive_serialization_quotes(
    params: [(Quoted, Type)],
    use_self_prefix: bool,
) -> (Quoted, Quoted, Quoted)

Generates serialization code for a list of parameters and the total length of the serialized array

Parameters

  • params: A list of (name, type) tuples to serialize
  • use_self_prefix: If true, parameters are accessed as self.$param_name (for struct members). If false, parameters are accessed directly as $param_name (for function parameters).

Returns

A tuple containing:

  • Quoted code that serializes the parameters into an array named serialized_params
  • Quoted code that evaluates to the total length of the serialized array
  • Quoted code containing the name of the serialized array