Crate prest

Source
Expand description

These docs are focused on technical details. For tutorials check out prest.blog

Re-exports§

  • pub use result::AnyError;
  • pub use axum;
  • pub use axum::http;

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::Error values like e!("{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::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§

  • 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 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.
  • 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::Runtime that 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-code in 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) or Json (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§

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.
  • Route DELETE requests to the given handler.
  • Fetches the environment variable key from the current process.
  • Create a middleware from an async function.
  • Deserialize an instance of type T from bytes of JSON text.
  • Deserialize an instance of type T from a string of JSON text.
  • Route GET requests 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 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
  • Waits until duration has elapsed.
  • Spawns a new asynchronous task, returning a JoinHandle for it.
  • Requires a Future to complete before the specified duration has elapsed.
  • 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