Expand description
Core types for the jigs framework.
A jig is one step in a request-to-response pipeline. Four kinds exist:
RequesttoRequest— enrich, validate, transformRequesttoResponse— handler that produces a responseResponsetoResponse— post-process the outgoing messageRequesttoBranch<Req, Resp>— guard that may short-circuit
Pipelines are built by chaining jigs with .then(...). The type system
enforces ordering: once you hold a Response, you cannot chain a jig that
expects a Request. A Response carrying an error short-circuits the
remainder of the pipeline; so does a Branch::Done.
Structs§
- Pending
- Wraps a future returned by an async jig so the chain remains spelled with
.then. - Request
- Inbound message flowing through a pipeline.
- Response
- Outbound message produced by a pipeline. Wraps a
Resultso that downstream jigs can short-circuit on error.
Enums§
- Branch
- Outcome of a guard jig: either continue with a (possibly transformed) request, or short-circuit the pipeline with a response.
Traits§
- Jig
- One step in a jigs pipeline. Any
Fn(In) -> Outautomatically implements this trait, so plain functions, closures, and#[jig]-annotated functions can all be chained with.then(...). - Merge
- Glue trait that lets a
Branch::then(jig)accept a jig whose output is aRequest, aResponse, or anotherBranch, and merge the two outcomes into a single value. - Status
- Common interface used by tracing to inspect a jig’s outcome without
knowing whether the value is a
Request,Response, orBranch. - Step
- Lifts the output of a jig into a future, so async and sync jigs can be chained
uniformly inside a
Pendingchain. Sync values become aReadyfuture, a nestedPendingis unwrapped to its inner future.