Expand description
Utility functions for web application development.
This includes
- commonly used
chars, - a
build_bytesmacro to create aBytesfrom bytes slices with one allocation, WriteableBytesto optimize performance when creating a newBytesof unknown length,hardcoded_error_bodyto get a hard-coded error response.CleanDebugand it’s traitAsCleanDebugto get aDebugimplementation wired to the item’sDisplayimplementation.
Modules§
- chars
- Common characters expressed as a single byte each, according to UTF-8.
- extensions
- Parsing utilities and constants for Kvarn extensions.
- parse
- General parsing complying to the HTTP standards.
- prelude
- The prelude for common web application utilities.
Macros§
- build_
bytes - Convenience macro to create a
Bytesfrom multiple&[u8]sources. - field_
str - Stringify $field on $self. This only returns the field name. This is constructed to make your IDE recognize the input as the actual field. This means renaming is applied to the string returned from this when you rename a field in your IDE.
- fmt_
field - Adds a
$fieldto thestd::fmt::DebugStruct,$ffrom$self. - fmt_
fields fmt_field!but multiple.- ident_
str - Return stringified representation of
$item. This uses similar techniques toident_str!. - starts_
with_ any - Tests if the first arguments starts with any of the following.
Structs§
- Clean
Debug - Implements
Debugfrom theDisplayimplementation ofvalue. - Critical
Request Components - Critical components from request to apply to response.
- Present
Arguments - The arguments and name of a single
Presentextension. - Present
Arguments Iter - An iterator of
strfor the arguments inPresentArguments - Present
Extensions - The
Presentextensions parsed from a file containing them. - Present
Extensions Iter - An iterator of
PresentArgumentsfromPresentExtensions - Quoted
StrSplit Iter - Iterator for
quoted_str_split. Returns owned strings. - Value
Quality Set - A pair of a value string and a quality of said value.
- Writeable
Bytes - A writeable
Bytes.
Enums§
- Bytes
Cow Bytesbut potentiallyBytesMut, which enables e.g. changing the data without allocations when chainingPresentextensions.
Traits§
- AsClean
Debug - Trait to enable
.as_cleanto get aCleanDebugfor the variable.
Functions§
- empty_
clone_ request - Clones a
Request, discarding the body. - empty_
clone_ response - Clones a
Response, discarding the body. - encode_
quoted_ str - Encodes, to be decoded by
quoted_str_split,srcby appending todest. - get_
body_ length_ request - Gets the body length from the
Request::headersofrequest. - get_
body_ length_ response - Gets the body length of a
response. - hardcoded_
error_ body - Get a hardcoded error message.
- header_
eq - Checks the equality of value of
nameinheadersandvalue. Value does not need to be all lowercase; the equality operation ignores the cases. - is_
valid_ header_ value_ byte - Checks
byteif it’s a valid byte forHeaderValues. - join
- Joins the items in
iterwith aseparatorusing 1 allocation. - list_
header - Parses a header with a value-quality list of pairs.
- make_
path - Makes a
PathBufusing one allocation. - method_
has_ response_ body - Does a response of type
methodhave a body? - percent_
decode - Decodes the URI encoding.
- quoted_
str_ split - Shell-like splitting of
s. - remove_
all_ headers - Removes all headers from
headerswithname. - sanitize_
request - Sanitizes
requestfor unwanted data and returns critical components. - set_
content_ length - Sets the
content-lengthofheaderstolen. - split_
response - Splits a
Responseinto a emptyResponseand it’s body. - valid_
method - Check if
bytesstarts with a validMethod. - valid_
version - Checks if
bytesstarts with a validVersion