feat(sdk): rename attribute to #[chain_module], keep #[fai_module] alias
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s

The public macro name was the last product-scoped 'fai' identifier
in the SDK surface. #[chain_module] is now the primary attribute
(README + examples updated); #[fai_module] stays as a delegating
alias so modules written before the rename keep compiling. 0.2.1.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-07-11 19:02:40 +02:00
parent 40f3dbd885
commit 4b4de3374c
9 changed files with 33 additions and 19 deletions

View file

@ -7,7 +7,7 @@ A module written against this crate looks like:
```rust
use chain_module_sdk::prelude::*;
#[fai_module]
#[chain_module]
fn invoke(_ctx: Context, inputs: Inputs) -> Result<Outputs, ModuleError> {
let text = inputs.require_text("input")?;
Ok(Outputs::new().with_text("output", format!("echo: {text}")))
@ -16,7 +16,7 @@ fn invoke(_ctx: Context, inputs: Inputs) -> Result<Outputs, ModuleError> {
That single function — plus a `Cargo.toml` listing
`chain-module-sdk` as a dependency — is the entire module. The
`#[fai_module]` macro generates the `wit_bindgen` invocation, the
`#[chain_module]` macro generates the `wit_bindgen` invocation, the
`Guest` implementation, the type conversions, and the
`wit_bindgen::export!` glue behind the scenes.
@ -28,7 +28,7 @@ That single function — plus a `Cargo.toml` listing
| `Outputs::new().with_json(...)?` | building `Vec<(String, Payload)>` by hand |
| `ModuleError::invalid_input("...")` | constructing WIT `invocation-error` variants |
| `ctx.emit("progress", ...)` | hand-rolling the `host.emit-event` import (WIT 1.1) |
| `#[fai_module]` | `wit_bindgen::generate!` + `Guest` impl + `export!` + `#![allow(unsafe_op_in_unsafe_fn)]` |
| `#[chain_module]` | `wit_bindgen::generate!` + `Guest` impl + `export!` + `#![allow(unsafe_op_in_unsafe_fn)]` |
## Stability