Skip to main content

Crate caravan_rpc_macros

Crate caravan_rpc_macros 

Source
Expand description

Procedural macros for the Caravan RPC SDK.

The single attribute macro #[wagon] marks a trait as a seam interface. Behaviour depends on the trait shape:

  • Sync trait (no #[async_trait], no async fn) — args may be owned (String, Vec<T>) or borrowed in the narrow set the macro knows how to lower (&strString, &[T]Vec<T>, &[&str]Vec<String>). Emits <Trait>HttpClient + impl <Trait> for <Trait>HttpClient (calls go over HTTP via dispatch::dispatch_sync)

    • build_<trait_snake>_router(impl_arc) axum router builder.
  • Anything else (async-trait, async fn, exotic arg types) → expand to the trait unchanged (identity behaviour, same as the B0p macro). Async-trait support lands later in M2 Session 4.

Code-rag’s traits at Session 4-narrow:

  • Embedder (sync + &str + &[&str]) → full codegen, suitable for dev-split-light’s Embedder: container mode flip.
  • Reranker (sync + &str + Vec<String>) → would be full codegen except for the third-party fastembed::RerankResult return type lacking serde; left identity until M5.
  • LlmClient + VectorReader (#[async_trait]) → identity until Session 4-async lands.

Attribute Macros§

wagon
Mark a trait as a Caravan RPC seam interface.