Skip to main content

Module command

Module command 

Source
Expand description

The Command trait and the DynCommand helper.

A Command pairs a string identifier with a typed request/response pair and an async handler. For compile-time commands, the #[command] attribute macro generates the trait impl; for runtime-constructed commands (plugin runtimes, FFI, scripting hosts), DynCommand lets you build a Command instance whose id / description / schema are owned at runtime.

Structs§

DynCommand
A runtime-constructed Command. Use this when the command id or schema is only known at runtime (plugin runtimes, FFI, scripting hosts).

Traits§

Command
A typed command handler registered with a CommandRegistry.

Type Aliases§

BoxedDynCommand
A DynCommand with fully erased handler types — request and response are serde_json::Value, the handler is a boxed async closure. Use when you need to store a heterogeneous collection of runtime commands (e.g. Vec<BoxedDynCommand> inside a plugin host).
BoxedHandler
Type-erased async handler for a BoxedDynCommand: takes and returns raw JSON Values.