Expand description
Procedural macro for the #[contract] attribute.
This macro is applied to a module containing a contract struct and its
impl block. It extracts metadata about public methods and events, and
generates a CONTRACT_SCHEMA constant plus extern “C” wrappers.
§Pipeline
- [
parse::analyze] walks the user module and produces an [parse::Analysis] (functions, registered events, imports, contract identifier). - [
generate] / [data_driver] consume the analysis and emit the contract or data-driver bindings.
lib.rs only orchestrates these two phases — all walking, validation,
and IR construction lives in the parse module.
§Example
ⓘ
#[contract]
mod my_contract {
use my_crate::MyType;
use dusk_core::abi;
pub struct MyContract {
value: u64,
}
impl MyContract {
pub fn set_value(&mut self, value: MyType) {
// ...
}
}
}Attribute Macros§
- contract
- The main contract proc macro.