Skip to main content

Crate sim_macros

Crate sim_macros 

Source
Expand description

Proc-macro surface for authored SIM libraries.

#[sim_class], #[sim_constructor], #[sim_fn], #[sim_macro], #[sim_codec], #[sim_number_domain], #[sim_site], #[case], and #[shape] are marker attributes. They do not transform the attached item on their own. #[sim_lib(...)] scans an inline module for those markers, validates the contracts, and generates the runtime registration and optional native ABI glue.

Invalid shape literals and missing generated-class constructors are rejected during macro expansion rather than silently widening contracts.

Attribute Macrosยง

case
Marks a function inside a #[sim_lib] module as a test case. It is consumed by #[sim_lib]; applied on its own it leaves the item unchanged.
shape
Attaches a shape literal to an item inside a #[sim_lib] module. It is consumed by #[sim_lib]; applied on its own it leaves the item unchanged.
sim_class
Marks a struct inside a #[sim_lib] module as a SIM class. It is consumed by #[sim_lib]; applied on its own it leaves the item unchanged.
sim_codec
Marks a codec export inside a #[sim_lib] module. The marker names the codec symbol plus decoder and encoder functions that are called by generated native ABI dispatch.
sim_constructor
Marks a function inside a #[sim_lib] module as a class constructor. It is consumed by #[sim_lib]; applied on its own it leaves the item unchanged.
sim_fn
Marks a function inside a #[sim_lib] module as a SIM operation. It is consumed by #[sim_lib]; applied on its own it leaves the item unchanged.
sim_lib
Expands an inline module into a SIM library.
sim_macro
Marks a macro export inside a #[sim_lib] module. The marker names the macro symbol plus the expansion function called by host registration and generated native ABI dispatch.
sim_number_domain
Marks a number-domain export inside a #[sim_lib] module. The marker names the domain symbol plus guest functions that are called by generated native ABI dispatch for parsing, literal encoding, and optional scalar operations.
sim_site
Marks a site export inside a #[sim_lib] module. The marker names the site symbol plus the function called by generated native ABI dispatch for realization requests.