Expand description
These docs are focused on technical details. For tutorials check out prest.blog
Re-exports
Modules
- Inspection and manipulation of the process’s environment.
- Types and traits for extracting data from requests.
- HTTP header types
- Server-Sent Events (SSE) responses.
- Asynchronous streams.
Macros
- Construct an ad-hoc error from a string or existing non-
anyhow
error value. - Return early with an error.
- Constructs an event at the debug level.
- One-liner for structs with derived Embed
- Shorthand to embed build artifacts like PWA assets and others
- Inspects an environment variable at compile time.
- Constructs an event at the error level.
- Compose HTML templates right inside of Rust code with ease.
- Constructs an event at the info level.
- Construct a
serde_json::Value
from a JSON literal. - Constructs an event at the trace level.
- Constructs an event at the warn level.
Structs
- Append headers to a response.
- A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
- The body type used in axum requests and responses.
- A file embedded into the binary
- The
Error
type, a wrapper around a dynamic error type. - An
IntoResponse
-based error type - Wrapper of a buffer that escapes HTML chars when it is written using
fmt::Write
- Extractor and response for extensions.
- URL encoded extractor and response.
- A
Service
adapter that handles errors by converting them into responses. Layer
that appliesHandleError
which is aService
adapter that handles errors by converting them into responses.- Renders into a
<head>
tag with builder-like interface - A set of HTTP headers
- Represents an HTTP header field value.
- Extractor that resolves the hostname of the request.
- An HTML response.
- Layer that modifies non-HTMX requests with the provided
Fn
- JSON Extractor / Response.
- A value which is initialized on the first access.
- Access the path in the router that matches the request.
- The Request Method (VERB)
- An asynchronous
Mutex
-like type. - Access the path the matched the route is nested at.
- The remainder of a middleware stack, including the handler.
- A thread-safe cell that can be written to only once.
- Extractor that gets the original request URI regardless of nesting.
- Extractor that will get captures from the URL and parse them using
serde
. - A wrapper that renders the inner value without escaping.
- Extractor that deserializes query strings into some type.
- Response that redirects the request to another location.
- Parts of a response.
- The router type for composing handlers and services.
- The Tokio runtime.
- Builds Tokio Runtime with custom configuration values.
- Handle to the runtime.
- An asynchronous reader-writer lock.
- Renders into a bunch of
<script>
tags with builder-like interface - Declaratively construct
Service
values. - An SSE response
- Server-sent event
- Configure the interval between keep-alive messages, the content of each message, and the associated stream.
- An HTTP status code (
status-code
in RFC 7230 et al.). - A TCP socket server, listening for connections.
- The URI component of a request.
- A Universally Unique Identifier (UUID).
Enums
- The error type for errors that can never happen.
- The flavor of a
Runtime
.
Constants
- Default doctype for HTML
- Default javascript code that registers a service worker from
/sw.js
Statics
Traits
- Derived trait for structs that embed files
- Types that can be created from requests.
- Types that can be created from request parts.
- Utility trait to use Router as the host
- Trait representing a streaming body of a Request or Response.
- Trait for generating responses.
- Trait for adding headers and extensions to a response.
- Decorates a
Service
, transforming either the request or the response. - Trait that defines how something is rendered into HTML
- An asynchronous function from a
Request
to aResponse
. - A stream of values produced asynchronously.
- An extension trait for
Stream
s that provides a variety of convenient combinator functions. - Adapters specific to
Result
-returning streams
Functions
- Route requests with the given handler regardless of the method.
- Runs the provided blocking function on the current thread without blocking the executor.
- Run a future to completion on the current thread.
- Route
DELETE
requests to the given handler. - Create a middleware from an extractor.
- Create a middleware from an extractor with the given state.
- Create a middleware from an async function.
- Create a middleware from an async function with the given state.
- Route
GET
requests to the given handler. - Route
PATCH
requests to the given handler. - Route
POST
requests to the given handler. - Route
PUT
requests to the given handler. - A little helper to init router and route in a single call to improve formatting
- Entry point function to build statement
Type Aliases
- Alias for a type-erased error type.
- A block of markup is a string that does not need to be escaped.
- Type alias for [
http::Request
] whose body type defaults toBody
, the most common body type used with axum. - Type alias for [
http::Response
] whose body type defaults toBody
, the most common body type used with axum. Result<T, Error>
Attribute Macros
Derive Macros
- Derive macro that embeds files and provides access to them through the given struct