Expand description
These docs are focused on technical details. For tutorials check out prest.blog
Re-exports§
Modules§
- Types and traits for extracting data from requests.
- HTTP header types
- re-export of GlueSQL core AST builder and other utils
- Asynchronous streams.
Macros§
- Constructs an event at the debug level.
- Shorthand to create formatted
prest::Errorvalues likee!("{x:?}") - One-liner for structs with derived Embed
- Shorthand to embed build artifacts like PWA assets and others
- Constructs an event at the error level.
- Compose HTML templates right inside of Rust code with ease.
- Shorthand for `PreEscaped(include_str!(…))``
- Constructs an event at the info level.
- Construct a
serde_json::Valuefrom a JSON literal. - Macro that simplifies lazy globals by reducing boilerplate, allowing
?operator and async init - Constructs an event at the trace level.
- Constructs an event at the warn level.
Structs§
- A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
- The body type used in axum requests and responses.
- Embedded database
- An
IntoResponse-based error type - Extractor and response for extensions.
- A
Serviceadapter that handles errors by converting them into responses. Layerthat appliesHandleErrorwhich is aServiceadapter 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.
- A collection of tasks spawned on a Tokio runtime.
- 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. - ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
- ISO 8601 combined date and time without timezone.
- ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.
- Access the path the matched the route is nested at.
- The remainder of a middleware stack, including the handler.
- 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.
- Wrapper around
tokio::runtime::Runtimethat manages schedule and graceful shutdown - Response that redirects the request to another location.
- The router type for composing handlers and services.
- An asynchronous reader-writer lock.
- Describes collected stats for scheduled jobs
- Renders into a bunch of
<script>tags with builder-like interface - An SSE response
- Broadcasting singleton for SSE (check out todo sync example)
- Server-sent event
- Configure the interval between keep-alive messages, the content of each message, and the associated stream.
- An HTTP status code (
status-codein RFC 9110 et al.). - The URI component of a request.
- The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
- A Universally Unique Identifier (UUID).
- Utility that deserializes from either [
Query] (GET) orJson(others) based on request method
Enums§
- Error type used across prest codebase
Constants§
- Default doctype for HTML
- Utility for type inference that allows using
?operator in closure handlers - Default javascript code that registers a service worker from
/sw.js
Statics§
- Holds initialized [
AppConfig], requires arguments from the init macro to initialize so cant be Lazy
Traits§
- Simplified interface for queries to run with
DB - Types that can be created from requests.
- Types that can be created from request parts.
- An extension trait for
Futures that provides a variety of convenient adapters. - Utility trait to use Router as the host
- Convenience trait to easily add [
HtmxLayer] to theRouter - Trait representing a streaming body of a Request or Response.
- Trait for generating responses.
- Trait that defines how something is rendered into HTML
- Simplified interface to run
RepeatableJobs in prest’sRT - Utility to
stream_and_renderSseBroadcasts - A stream of values produced asynchronously.
- An extension trait for
Streams that provides a variety of convenient combinator functions. - Derived interface to interact with structs as tables of their values
- Derived interface to access schemas of derived
Tables - 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.
- Route
DELETErequests to the given handler. - Fetches the environment variable
keyfrom the current process. - Create a middleware from an async function.
- Deserialize an instance of type
Tfrom bytes of JSON text. - Deserialize an instance of type
Tfrom a string of JSON text. - Route
GETrequests to the given handler. - Returns whether PWA will be built with current configs
- Creates a future which represents a collection of the outputs of the futures given.
- Utility for type inference that allows using
?operator in closure handlers - Route
PATCHrequests to the given handler. - Route
POSTrequests to the given handler. - Route
PUTrequests to the given handler. - A little helper to init router and route in a single call to improve formatting
- Waits until
durationhas elapsed. - Spawns a new asynchronous task, returning a
JoinHandlefor it. - Requires a
Futureto complete before the specified duration has elapsed. - Serialize the given data structure as a String of JSON.
Type Aliases§
- A block of markup is a string that does not need to be escaped.
- Type alias for
http::Requestwhose body type defaults toBody, the most common body type used with axum. - Type alias for
http::Responsewhose body type defaults toBody, the most common body type used with axum. - Basic Result alias with
prest::Error - Anyhow-like result which can be
?from any error type - Alias for Server Sent Events event
Attribute Macros§
Derive Macros§
- Derive macro that embeds files and provides access to them through the given struct
- Generates schema and helper functions to use struct as a table in the embedded database