Expand description
Shared text helpers for the generators: C symbol naming, the standard generated-file prelude/trailer, and cross-module type-name resolution.
These are the small string-building routines every backend reaches for
when stamping the “generated by WeaveFFI” banner onto a file or turning a
qualified module.Type reference into its flattened C symbol. Centralizing
them keeps the banner, the symbol-prefixing rule, and the dotted-path
flattening identical across all of the language generators.
Enums§
- Comment
Style - Comment syntax used to emit the standard prelude/trailer in generated files.
Constants§
- ABI_
RUNTIME_ SYMBOLS - Runtime symbols (functions and types) that consumer code links against from
the
weaveffi-abiruntime: theweaveffi_error/weaveffi_handle_t/weaveffi_cancel_tokentypes and every#[no_mangle]entry point thatweaveffi_abi::export_runtime!emits into the consumer cdylib.
Functions§
- c_
abi_ struct_ name - Build the C ABI struct name, resolving cross-module qualified references.
- c_
symbol_ name - Build the C symbol name for a function:
<prefix>_<module>_<func>. - local_
type_ name - Extract the local type name from a potentially qualified
module.TypeName. - render_
abi_ prefix_ aliases - Render a
#define {prefix}_{name} weaveffi_{name}block for runtime ABI symbols. Returns an empty string whenprefix == "weaveffi". - render_
json_ prelude - Renders the JSON-friendly prelude as
"//"key/value pairs (recognised by npm). Each line is two-space-indented and comma-terminated so it can be embedded at the top of any JSON object literal that opens with{on the previous line. - render_
prelude - Renders the standard
Generated by WeaveFFI {VERSION} from {input}prelude followed by theDO NOT EDITwarning and a regenerate command. Trailing blank line included so generators can append their content directly. - render_
trailer - Renders the closing
END {filename}marker. Caller is responsible for any preceding newline; the returned string ends with\n. - wrapper_
name - Build the wrapper function name exposed to the foreign language.