Expand description
Routing and binding, transport-neutral: a request in, a response out.
The router names no surface. It asks super::surfaces::Served — the web topology this
process resolved, narrowed to what it can answer — who owns a path, and dispatches to
what that surface bound. A route under /api/v1/ is a capability with an HTTP exposure;
/, /openapi.json, /swagger, /cockpit and /mcp are routes the executable answers
itself; /docs/ and every generated report are directories a producer wrote. All of them
are declared once, in crate::web::discover, and reach the router, the home page, the
web.surfaces capability and the publication from there.
Structs§
- Error
Body - The body of every error response.
- Error
Detail - What went wrong, as the HTTP projection names it.
- Request
- A request as the router sees it: method, path without query, decoded query pairs, headers, and the body.
- Response
- A response as the router produces it; the server adds the wire.
- Router
- Routes requests to the surfaces this process serves. Cheap to clone: every worker thread holds one, and the resolution behind it is shared.
- Served
Ref - The surfaces a router serves, held for as long as its reader needs them.
Enums§
- Body
- What a response carries. Text for everything this projection computes; bytes for a file it serves from disk, which is not always UTF-8 and must not be repaired into it.
Functions§
- percent_
decode %XXand+decoding; a malformed escape is kept as it is.- percent_
encode - Percent-encode everything but the unreserved characters of RFC 3986.
- prefers_
html - Does this request come from something that would rather have a page than a document?
Only an explicit
text/htmlinAcceptcounts: a client that sends none, or*/*, gets the JSON index, which is what every existing caller does.