Skip to main content

Crate plexus_macros

Crate plexus_macros 

Source
Expand description

Plexus RPC Method Macro

Proc macro for defining Plexus RPC methods where the function signature IS the schema.

§Example

use hub_macro::{hub_methods, hub_method};

#[hub_methods(namespace = "bash", version = "1.0.0")]
impl Bash {
    /// Execute a bash command
    #[hub_method]
    async fn execute(&self, command: String) -> impl Stream<Item = BashEvent> {
        // implementation
    }
}

The macro extracts:

  • Method name from function name
  • Description from doc comments
  • Input schema from parameter types
  • Return type schema from Stream Item type

Attribute Macros§

hub_method
Attribute macro for hub methods within an impl block.
hub_methods
Attribute macro for impl blocks containing hub methods.

Derive Macros§

HandleEnum
Derive macro for type-safe handle creation and parsing.
StreamEventDeprecated
DEPRECATED: This derive macro is no longer needed.