Expand description
Response model. Handlers return anything implementing IntoResponse;
Result<T, Error> renders errors as {"code","message"} JSON (spec §4.1).
Structs§
- Body
Error - Mid-stream body failure. Reaching hyper as a body error aborts the connection, so the client sees a truncated (invalid) chunked stream rather than a clean end — truncation must be detectable.
- Body
Sender - Push side of
StreamBody::channel. - Created
- 201 Created with a JSON body.
- JcBody
- The response body: a fixed buffer for buffered handlers, or a stream when a
handler returns
StreamBody(downloads, exports). Wraps aBoxBodyso the response type is stable whichever shape the body takes; its error channel isBodyError, which a mid-stream failure rides to abort the connection. - Json
- JSON body wrapper:
Json(value)serializes withapplication/json. - NoContent
- 204 No Content.
- Redirect
- An HTTP redirect: an empty body plus a
Locationheader and a 3xx status. Use the constructor that names the semantics you want —to/see_other/temporary/permanent— rather than hand-setting a status code. - Stream
Body - A streaming response body: downloads, CSV exports, anything produced
incrementally. Defaults:
application/octet-stream, 200 OK, 30s frame timeout (a producer that stalls longer aborts the connection).
Traits§
- Into
Response - Conversion of handler return values into HTTP responses.
Type Aliases§
- Response
- The concrete response type. Streaming bodies ride the same
IntoResponseseam as buffered ones, so handler signatures won’t change.