Expand description
Core traits and types for Volter.
This crate defines the foundational abstractions the rest of the Volter ecosystem builds on:
IntoResponse— how values turn into HTTP responses.FromRequestParts/FromRequest— typed extraction from requests.Handler— async function handlers.HandlerService— atower::Serviceadapter for handlers.Body,BoxBody,Request,Response— core HTTP type aliases.
See ARCHITECTURE.md at the workspace root for the reasoning behind
this design, and RULES.md for the constraints every implementation
must follow.
Re-exports§
pub use http;
Structs§
- Handler
Service - A
tower::Serviceadapter that wraps aHandlertogether with its state. - State
- Extract typed application state.
- UrlParams
- Path parameters extracted by the router from a parameterized route.
Traits§
- From
Request - Extract a typed value that may need the request body (e.g.
Json<T>). - From
Request Parts - Extract a typed value from the request’s
http::request::Parts(method, URI, headers, extensions) without consuming the body. - Handler
- A request handler: any async function whose arguments are extractors,
and whose return type implements
IntoResponse. - Into
Response - Turn a value into an HTTP
Response.
Functions§
- empty_
body - Create an empty boxed body.
- full_
body - Create a boxed body from a chunk of bytes.
Type Aliases§
- Body
- The default request/response body type used throughout Volter.
- BoxBody
- A type-erased,
SendHTTP body used throughout Volter. - BoxError
- A boxed, dynamic error used where callers need
Send + Sync + 'static. - Request
- The request type used throughout Volter: a thin alias over
http::Requestwith a boxed, streaming body. - Response
- The response type used throughout Volter.