Skip to main content

Crate cmdreg

Crate cmdreg 

Source

Re-exports§

pub use inventory;

Structs§

CommandMap
A generic string-keyed map for storing command handlers.
CommandMeta
Metadata describing a registered command.
CommandParamMeta
Metadata for a single command parameter.
CommandRegistration
A registration entry collected by the #[command] macro via inventory.
Json
A wrapper for JSON-deserialized command arguments (axum-style extractor).
NoArgsBody
Marker type for handlers that take no arguments.

Enums§

CommandContext
The context passed to a command handler, carrying the input arguments.
CommandResponse
The response from a command handler.

Traits§

CommandHandler
Trait for synchronous command handlers.
CommandHandlerAsync
Trait for asynchronous command handlers.
FromCommandArgs
Trait for extracting typed arguments from a CommandContext.

Functions§

clear_command_callback
Clear all registered callback commands.
clear_commands
Clear all registered sync commands.
clear_commands_async
Clear all registered async commands.
export_commands_json
Export all command metadata to a JSON file at the given path.
get_all_command_metas
Collect metadata for all commands registered via #[command] macros.
get_command_async_keys
Get all registered async command keys.
get_command_async_len
Get the number of registered async commands.
get_command_callback_keys
Get all registered callback command keys.
get_command_callback_len
Get the number of registered callback commands.
get_command_keys
Get all registered sync command keys.
get_command_len
Get the number of registered sync commands.
invoke_command
Invoke a sync command by key.
invoke_command_async
Invoke an async command by key.
invoke_command_callback
Invoke a callback command by key.
invoke_command_callback_lazy
Invoke a callback command with automatic serialization/deserialization.
reg_all_commands
Execute all auto-registered command handlers collected by #[command] macros.
reg_command
Register a sync command handler.
reg_command_async
Register an async command handler.
reg_command_callback
Register a callback command handler.
unreg_command
Unregister a sync command.
unreg_command_async
Unregister an async command.
unreg_command_callback
Unregister a callback command.

Type Aliases§

CommandHandlerValueCallback
CommandHandlerValueCallbackResult
CommandResult
The result type returned by all command handlers.

Attribute Macros§

command
Mark a function as a command handler and auto-register it.