Module kvarn::prelude

source ·
Expand description

The Kvarn Prelude

The purpose of this module is to simplify, make modules dependencies obvious, and keep consistency in the development of the Kvarn web server.

Other specialised preludes can be found as modules, including

  • a fs prelude
  • a networking prelude
  • an internals prelude
  • a threading prelude


pub use crate::application;
pub use crate::comprash;
pub use crate::cors;
pub use crate::csp;
pub use crate::encryption;
pub use crate::extensions;
pub use crate::host;
pub use crate::limiting;
pub use crate::vary;
pub use kvarn_async as async_bits;
pub use kvarn_utils as utils;
pub use comprash::UriKey;
pub use cors::AllowList as CorsAllowList;
pub use cors::Cors;
pub use csp::Csp;
pub use csp::Rule as CspRule;
pub use csp::Value as CspValue;
pub use csp::ValueSet as CspValueSet;
pub use error::default as default_error;
pub use error::default_response as default_error_response;
pub use extensions::Package;
pub use extensions::Post;
pub use extensions::Prepare;
pub use extensions::Present;
pub use extensions::Prime;
pub use extensions::ResponsePipeFuture;
pub use host::Collection as HostCollection;
pub use host::Host;
pub use read::file as read_file;
pub use read::file_cached as read_file_cached;
pub use shutdown::AcceptAction;
pub use shutdown::AcceptManager;
pub use crate::*;


Provides abstractions for working with bytes.
Common characters expressed as a single byte each, according to UTF-8.
Prelude: time
Utilities for comparing and ordering values.
Parsing utilities and constants for Kvarn extensions.
Utilities for formatting and printing Strings.
Prelude: file system
HTTP header types
Prelude: internal
Traits, helpers, and type definitions for core I/O functionality.
Networking primitives for TCP/UDP communication.
Prelude: networking
General parsing complying to the HTTP standards.
Utilities for the str primitive type.
Prelude: internal
URI component of request and response lines
Utility functions for web application development.


Derive macro generating an impl of the trait Debug.
Derive macro generating an impl of the trait Ord.
Derive macro generating an impl of the trait PartialOrd.
Convenience macro to create a Bytes from multiple &[u8] sources.
Logs a message at the debug level.
Logs a message at the error level.
Logs a message at the info level.
The standard logging macro.
Logs a message at the trace level.
Logs a message at the warn level.


A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
A cheaply cloneable and sliceable chunk of contiguous memory.
A unique reference to a contiguous slice of memory.
The context of an asynchronous task.
A Duration type to represent a span of time, typically used for system timeouts.
Configuration for formatting.
A hash map implemented with quadratic probing and SIMD lookup.
A set of HTTP headers
Represents an HTTP header field name
Represents an HTTP header field value.
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
The Request Method (VERB)
An asynchronous Mutex-like type.
A slice of a path (akin to str).
An owned, mutable path (akin to String).
A pinned pointer.
A wrapper around a byte buffer that is incrementally filled and initialized.
Represents an HTTP request.
Represents an HTTP response
An asynchronous reader-writer lock.
An HTTP status code (status-code in RFC 7230 et al.).
The URI component of a request.
Represents a version of the HTTP spec.
A writeable Bytes.


A clone-on-write smart pointer.
An IP address, either IPv4 or IPv6.
Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.
An error regarding the sanitization of a request.
An internet socket address, either IPv4 or IPv6.



Trait to enable .as_clean to get a CleanDebug for the variable.
Reads bytes from a source.
Reads bytes from a source.
Writes bytes asynchronously.
Writes bytes to a sink.
A BufRead is a type of Reader which has an internal buffer, allowing it to perform extra ways of reading.
? formatting.
Format trait for an empty format, {}.
A future represents an asynchronous computation obtained by use of async.
Trait for types that form a total order.
Trait for types that form a partial order.
The Read trait allows for reading bytes from a source.
The Seek trait provides a cursor which can be moved within a stream of bytes.
Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryInto.
A trait for objects which are byte-oriented sinks.


Casts &T to *mut T for getting mutable access from a immutable reference.