hub-macro 0.1.3

Proc macros for hub method definitions with session types
Documentation

Hub Method Macro

Proc macro for defining hub 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