Expand description
Procedural macros for [coralstack-cmd-ipc].
This crate provides four attribute macros that keep command and event definitions concise and colocated with their handlers:
command— mark one async fn/method as a command.command_service— mark animplblock; every method inside tagged with#[command("id")]becomes a registered command and the block gains a generatedregister(self, ®istry)helper that installs every command in one call.event— mark a payload struct as a typed event; emits theimpl Eventand auto-derivesSerialize/Deserialize/JsonSchema.payload— mark any struct (typically command requests and responses) to auto-deriveSerialize/Deserialize/JsonSchemawithout requiring the user crate to depend onserde/schemarsdirectly.
All four resolve their derives against the serde / schemars
re-exports published by coralstack-cmd-ipc, so user crates depend
on coralstack-cmd-ipc alone.
See the coralstack-cmd-ipc crate docs for usage examples and
end-to-end integration tests.
Attribute Macros§
- command
- Attach to an
async fn(free-standing or inside a#[command_service] implblock) to register it as a typed command. - command_
service - Attach to an
implblock whose methods are tagged with#[command]. - event
- Attach to a payload struct to register it as a typed event.
- payload
- Attach to a plain data struct to auto-derive
Serialize,Deserialize, andJsonSchema. Use for command request / response types (and any other struct you want those traits on) so user crates only need to depend oncoralstack-cmd-ipc.