Expand description
Procedural macros for BLVM SDK CLI module system.
Attribute Macros§
- arg
- Parameter attribute:
#[arg(long)],#[arg(short = 'o')],#[arg(default = "x")]. Use on CLI handler parameters for named-arg parsing and type coercion. - blvm_
module - Attribute macro:
#[blvm_module]- marks the main module struct. On struct:#[module(name = "demo", config = DemoConfig)]generates__module_new(config). Withmigrations = ((1, up_initial), (2, up_add_items_tree))also generatesModuleMetaimpl forrun_module_main!(DemoModule). On impl:#[module(name = "demo")]generates cli_spec, dispatch_cli, rpc_method_names, etc. - cli_
subcommand - Attribute macro:
#[cli_subcommand]or#[cli_subcommand(name = "...")]- on impl block. - command
- Attribute macro:
#[command(name = "...")]or#[module_cli(name = "...")]- on struct: marks CLI entry point. On impl block: generatescli_spec(). Same attribute works for both. - config
- Attribute macro:
#[config(name = "...")]or#[module_config(name = "...")]- marks a config struct. - config_
env - Field attribute:
#[config_env]or#[config_env("ENV_NAME")]. Use with#[module_config(name = "...")]on the struct. Pass-through; the real logic is inmodule_configwhich reads this attribute to generateapply_env_overrides(). - event_
handlers - Attribute macro:
#[event_handlers]- on impl block with #on_event methods. - migration
- Attribute macro:
#[migration(version = N)]or#[migration(version = N, down)]. - module
- Attribute macro:
#[module]or#[blvm_module]- marks the main module struct. With#[module(name = "demo")]on an impl block: generates CLI, RPC, and event dispatch from a single impl (replaces #command, #[rpc_methods], #event_handlers). - module_
cli - Attribute macro:
#[module_cli(name = "...")]- marks a struct as the module CLI entry point. - module_
config - on_
event - Attribute macro:
#[on_event(NewBlock, NewTransaction, ...)]- marks a method as event handler. Use with#[event_handlers]on the impl block. Pass-through; event_handlers reads this. - rpc_
method - Attribute macro:
#[rpc_method]or#[rpc_method(name = "...")]. - rpc_
methods - Attribute macro:
#[rpc_methods]- on impl block with #rpc_method methods.
Derive Macros§
- Module
CliSpec - Placeholder derive macro for future use.