Skip to main content

cpp_source_with_codec_namespace

Function cpp_source_with_codec_namespace 

Source
pub fn cpp_source_with_codec_namespace(
    ast: &Ast,
    key: LayoutKey,
    options: CodecOptions,
    codec_namespace: &str,
) -> Result<String, GenerateError>
Expand description

The C++ source of ast, its codec inside namespace codec_namespace.

The codec is free functions at the scope it is written in, named after what they encode — zd_enc_p_unsigned_long, zd_enc_string, zd_def_string — so every file whose types use an unsigned long or a string writes the same names. At file scope, two generated headers in one translation unit define each of them twice, and the compiler stops at the second. In a namespace of the file’s own, each header keeps its copy. The declarations stay where source puts them: their namespaces are the IDL modules’.

§Errors

As source_with_options.