Skip to main content

act_component

Attribute Macro act_component 

Source
#[act_component]
Expand description

Attribute macro for ACT component modules.

Transforms a module containing #[act_tool] functions into a complete WIT component implementation with wit_bindgen::generate!(), export!(), and a Guest trait implementation.

§Attributes

  • name = "..." (required) — Component name
  • version = "..." (required) — Component version
  • description = "..." (required) — Component description
  • default_language = "..." (optional, defaults to “en”) — BCP 47 language tag

§Example

#[act_component(
    name = "my-component",
    version = "0.1.0",
    description = "My ACT component",
)]
mod component {
    use super::*;

    #[act_tool(description = "Say hello")]
    fn greet(args: GreetArgs) -> ActResult<String> {
        Ok(format!("Hello, {}!", args.name))
    }
}