Crate prest

source ·
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 applies HandleError which is a Service 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-Refreshheader.
  • 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§

Constants§

Statics§

Traits§

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§

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