Expand description
Welcome to the trillium
crate!
This crate is the primary dependency for building a trillium app or library. It contains a handful of core types and reexports a few others that you will necessarily need, but otherwise tries to stay small and focused. This crate will hopefully be the most stable within the trillium ecosystem. That said, trillium is still pre 1.0 and should be expected to evolve over time.
To get started with this crate, first take a look at the
guide, then browse the docs for
trillium::Conn
.
At a minimum to build a trillium app, you’ll also need a trillium runtime adapter.
Re-exports
pub use log;
Macros
- Unwraps an
Result::Ok
or returns theConn
with a 500 status. - Unwraps an
Option::Some
or returns theConn
. - Macro for implementing Handler for simple newtypes that contain another handler.
- A convenience macro for logging the contents of error variants.
Structs
- The trillium representation of a http body. This can contain either
&'static [u8]
content,Vec<u8>
content, or a boxedAsyncRead
type. - A Trillium HTTP connection.
- The name of a http header. This can be either a
KnownHeaderName
or a string representation of an unknown header. - A
HeaderValue
represents the right hand side of a singlename: value
pair. - A header value is a collection of one or more
HeaderValue
. It has been optimized for the “oneHeaderValue
” case, but can accomodate more than one value. - Trillium’s header map type
- Performance and security parameters for trillium-http.
- This struct represents information about the currently connected server.
- Provides support for asynchronous initialization of a handler after the server is started.
- A handler for sharing state across an application.
- Store and retrieve values by
TypeId
. This allows storing arbitrary data that implementsSync + Send + 'static
.
Enums
- Concrete errors that occur within trillium’s http implementation
- A short nonehaustive enum of headers that trillium can represent as a u8. Use a
KnownHeaderName
variant instead of a &’static str anywhere possible, as it allows trillium to skip parsing the header entirely. - HTTP request methods.
- HTTP response status codes.
- The version of the HTTP protocol in use.
Traits
- The building block for Trillium applications.
Functions
- alias for
Init::new
- Constructs a new
State
handler from any Clone + Send + Sync + ’static. Alias forState::new
Type Aliases
- A HTTP protocol upgrade