#[command_service]Expand description
Attach to an impl block whose methods are tagged with #[command].
Rewrites the block so every #[command("id")] method becomes a typed
command wrapper struct implementing Command, and adds an inherent
register async method to the host type that installs every such
command on a &CommandRegistry.
ⓘ
#[command_service]
impl MathService {
#[command("math.add")]
async fn add(&self, req: AddReq) -> Result<i64, CommandError> { ... }
#[command("math.sub")]
async fn sub(&self, req: SubReq) -> Result<i64, CommandError> { ... }
}
// Registers both commands with one call:
MathService.register(®istry).await?;