Crate hub_macro

Crate hub_macro 

Source
Expand description

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

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§

StreamEventDeprecated
DEPRECATED: This derive macro is no longer needed.