taut-rpc-macros 0.1.0

Procedural macros for taut-rpc. See the taut-rpc crate for usage.
Documentation

Procedural macros for taut-rpc.

This crate is an implementation detail of taut-rpc; users should depend on taut-rpc and import the macros via its re-exports rather than depending on this crate directly.

Four macros are provided through Phase 4:

  • #[rpc] — attribute macro applied to a free async fn (queries and mutations only in Phase 1; #[rpc(stream)] lands in Phase 3). Supports #[rpc] and #[rpc(method = "GET")]. See SPEC §2 (architecture) and §4 (wire format).
  • #[derive(Type)] — derive macro that records a Rust type in the IR so the codegen step can emit a corresponding TypeScript definition. Works on structs (named, tuple, unit) and enums (unit, tuple, struct variants). See SPEC §3 (type mapping).
  • #[derive(TautError)] — derive macro that supplies the TautError trait impl (per-variant code() and http_status()) for an enum. See SPEC §3.3 (errors).
  • #[derive(Validate)] — derive macro that emits the Validate trait impl from per-field #[taut(...)] constraint attributes (min, max, length, pattern, email, url, custom). See SPEC §7 (validation bridge).

All macros report errors via syn::Error::into_compile_error so failures surface as compiler diagnostics rather than panics.