Expand description
Core types for the jigs framework.
A jig is one step in a request-to-response pipeline. Four kinds exist:
- Request -> Request — enrich, validate, transform
- Request -> Response — handler that produces a response
- Response -> Response — post-process the outgoing message
- Request -> Branch<Request, Response> — 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. Branch::Done and errored request-handling jigs
short-circuit the request side of the pipeline, but once a Response
exists every Response -> Response jig runs — including on errored
responses — so finalizers (logging, headers, error envelopes) always
see the outcome. Jigs that should only act on success must check
Response::is_ok themselves.
Re-exports§
Modules§
- json
- JSON string escaping utility shared by rendering crates.
- meta
- Compile-time metadata for every
#[jig]function in the binary.
Macros§
- fork
- Multi-arm fork. Predicates are checked in order; the first match
consumes the request and its jig is run. If none match, the
_ => defaultarm runs. Every arm must produce the sameOuttype; each arm’s internal pipeline can have its own intermediate types. - impl_
request - Wire a custom request type into the framework.
- impl_
response - Wire a custom response type into the framework.
Structs§
- Pending
- Wraps a future returned by an async jig so the chain remains spelled with
.then.
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 a request, a response, or anotherBranch, and merge the two outcomes into a single value. - Request
- An inbound message flowing through a pipeline.
- Response
- An outbound message produced by a pipeline.
- 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.