Skip to main content

Module contract

Module contract 

Source
Expand description

Contract tables: the per-declaration fingerprints a consumer checks when it loads the library.

The #[weaveffi::module] expansion exports, for each top-level module m, const {prefix}_contract_entry* {prefix}_{m}_contract(size_t* out_len), returning a static table of ContractEntry values sorted by id: one per declaration (function, interface and each of its members, record, enum, callback interface, and error domain) in m and its submodules. The expansion computes every entry at compile time and keeps only those whose #[cfg] holds, using contract_len and contract_compact in constant context, so the table reflects exactly what the build exports.

Structs§

ContractEntry
One declaration’s fingerprint ({prefix}_contract_entry in C).

Functions§

contract_compact
The enabled entries of entries, in order. M must be contract_len of entries.
contract_len
How many of entries are enabled (their flag is true).
contract_table⚠
The body of {prefix}_{module}_contract: write the table’s length to out_len and return its first entry (null for an empty table).