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§

activation
Attribute macro for impl blocks defining a Plexus activation.
hub_methodDeprecated
Deprecated: use plexus::method instead.
hub_methodsDeprecated
Deprecated: use plexus::activation instead.
method
Attribute macro for individual methods within a #[plexus::activation] impl block.

Derive Macros§

HandleEnum
Derive macro for type-safe handle creation and parsing.
PlexusRequest
Derive macro for typed HTTP/WebSocket request extraction.
StreamEventDeprecated
DEPRECATED: This derive macro is no longer needed.