#[chain]Expand description
Convert an async function into a BoxRunnable<InputType, OutputType> factory.
The macro generates a public function with the same name that returns a
BoxRunnable backed by a RunnableLambda.
The output type is inferred from the function signature:
Result<Value, _>→BoxRunnable<I, Value>(serializes to Value)Result<String, _>→BoxRunnable<I, String>(direct return)Result<T, _>→BoxRunnable<I, T>(direct return)
§Example
ⓘ
use synaptic_macros::chain;
use synaptic_core::SynapticError;
use serde_json::Value;
#[chain]
async fn uppercase(input: Value) -> Result<Value, SynapticError> {
let s = input.as_str().unwrap_or_default().to_uppercase();
Ok(Value::String(s))
}
// Returns BoxRunnable<Value, Value>
let runnable = uppercase();
// Typed output — returns BoxRunnable<String, String>
#[chain]
async fn to_upper(s: String) -> Result<String, SynapticError> {
Ok(s.to_uppercase())
}