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.
- Support for
Form<T>
- HTTP header types
- Traits, helpers, and type definitions for asynchronous I/O functionality.
- Support for
Json<T>
- Support for
Path<T>
- Support for
Query<T>
- 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.
- Starting point for prest apps that performs basic setup
- Construct a
serde_json::Value
from 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§
- Layer that modifies non-HTMX requests with the provided
Fn
- Holds basic information about the app
- Append headers to a response.
- A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
BaseDirs
provides paths of user-invisible standard directories, following the conventions of the operating system the library is running on.- The body type used in axum requests and responses.
- Describes
Table
-derived column schema - Describes a collection of
Table
-derived schemas - A file embedded into the binary
- 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
- The
HX-Boosted
header. - The
HX-Current-Url
header. - Represents a client-side event carrying optional data.
- The
HX-History-Restore-Request
header. - The
HX-Location
header. - The
HX-Prompt
header. - The
HX-Push-Url
header. - The
HX-Redirect
header. - The
HX-Refresh
header. - The
HX-Replace-Url
header. - The
HX-Request
header. - The
HX-Reselect
header. - The
HX-Trigger*
header. - The
HX-Reswap
header. - The
HX-Retarget
header. - The
HX-Target
header. - The
HX-Trigger
header. - The
HX-Trigger-Name
header. - 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.
ProjectDirs
computes the location of cache, config or data directories for a specific application, which are derived from the standard directories and the name of the project/organization.- Extractor that deserializes query strings into some type.
- Response that redirects the request to another location.
- Parts of a response.
- Describes collected stats for some path
- 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. - Interface for graceful shutdowns
- 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.). - Describes
Table
-derived table schema - The URI component of a request.
UserDirs
provides paths of user-facing standard directories, following the conventions of the operating system the library is running on.- A Universally Unique Identifier (UUID).
Enums§
- Storage of the embedded database
- Error type used across prest codebase
- The error type for errors that can never happen.
- The flavor of a
Runtime
. - Values of the
hx-swap
attribute. - Representation of a TOML value.
ValidationRejection
is returned when the validation extractor fails.
Constants§
- Default doctype for HTML
- Default javascript code that registers a service worker from
/sw.js
- Http status code returned when there are validation errors.
Statics§
Traits§
- Interface for the
APP_CONFIG
- Interface for the
DB
- Simplified interface for queries to run with
DB
- Derived trait for structs that embed files
- Types that can be created from requests.
- Types that can be created from request parts.
- Trait for types that can supply a reference that can be validated.
- 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
- This Trait represents job in timezone. It provides method perform.
- Simplified interface to run
RepeatableJob
s in prest’sRT
- 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. - Derived interface to interact with structs as tables of their values
- Derived interface to access schemas of derived
Table
s - Converts or resolves without blocking to one or more
SocketAddr
values. - 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. - Loads the .env file from the current directory or parents. This is typically what you want.
- 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. - Initializes log collection
- Returns whether PWA will be built with current configs
- 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
- Serialize the given data structure as a String of JSON.
Type Aliases§
Result<T, Error>
- Alias for a type-erased error type.
- Describes
Table
-derived columns schema - 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. - Basic Result alias with
prest::Error
` - Alias for Server Sent Events event
- Type representing a TOML table, payload of the
Value::Table
variant.
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