Expand description
Tii is a very fast, robust and flexible HTTP/1.1 web server crate which allows you to develop web applications in Rust. With no dependencies, it is very quick to compile and produces very small binaries, as well as being very resource-efficient.
Macros§
- configure_
type_ system - This macro configures casts of a single entity type.
- debug_
log - Calls debug!
- error_
log - Calls error!
- info_
log - Calls info!
- trace_
log - Calls trace!
- warn_
log - Calls warn!
Structs§
- Accept
Quality Mime Type - Represents one part of an accept mime
- Cookie
- Represents an HTTP cookie as in the
Cookieheader. - Http
Header - Represents an individual header.
- QValue
- QValue is defined as a fixed point number with up to 3 digits after comma. with a valid range from 0 to 1. We represent this as an u16 from 0 to 1000.
- Request
Body - Request body abstraction that will implement a generic read/write interface that does not require mut self to operate upon and can be shared with threads. Peculiarities like transfer and content encoding are handled by the inner implementation and hidden from the actual endpoints.
- Request
Context - This struct contains all information needed to process a request as well as all state for a single request.
- Response
- Represents a response from the server.
Implements
Into<Vec<u8>>so can be serialised into bytes to transmit. - Response
Body - Response
Body Sink AsWrite - Response
Context - Context object for response filters Contains both info of the request and response
- Route
Builder - Builder for a route/endpoint.
- Routeable
- Encapsulates a route and its handler.
- Router
Builder - Represents a sub-app to run for a specific host.
- Server
- Struct that represents a built server capable of handling connections from some sources. It does NOT own any OS resources like server sockets / file descriptors.
- Server
Builder - Represents the Tii app.
- SetCookie
- Represents an HTTP cookie as in the
Set-Cookieheader. - Thread
Adapter Join Handle - Represents an opaque join handle
- Type
System - Holds an immutable type system containing casting information
- Type
System Builder - Builder for the type system
- Websocket
Receiver - Receiving side of a web socket
- Websocket
Sender - Sending side of a web socket
Enums§
- Accept
Mime Type - Version of MimeType that can contain “*” symbols.
- Http
Header Name - Represents a header received in a request. TODO implement to &str fn to prevent clone on serialization!
- Http
Method - Represents an HTTP method.
- Http
Version - Enum for http versions tii supports.
- Invalid
Path Error - Mime
Group - Mime types are split into groups denoted by whatever is before of the “/”
- Mime
Type - Represents a MIME type as used in the
Content-Typeheader. - Read
Message Timeout Result - Return enum for the fn WebsocketReceiver::read_message_timeout
- Request
Head Parsing Error - Router
WebSocket Serving Response - A router may respond to a web-socket request with a http response or indicate that the socket has been handled with a protocol switch Or it may indicate that it hasn’t handled the socket and signal that the next router should do it. This enum represents those 3 states
- Routing
Decision - Enum that shows information on how a particular request could be routed on a route.
- Same
Site - Represents the SameSite value of the cookie.
- Status
Code - Represents an HTTP status code.
- TiiError
- Type
System Error - Errors that can occur when dynamic types have to be handled
- User
Error - Websocket
Message - Represents a WebSocket message.
Traits§
- Connection
Stream - This represents a raw stream source the server can use to server requests to. Each instance of this represents a dedicated client connection.
- Connection
Stream Metadata - Trait for metadata for streams. This could for example be an indicator of what type of stream this is if this is relevant for your application. For example an app may ingest connections from a plain and tls socket at the same time. This could be used to indicate this, or indicate things like “is there a client Certficate present and if so which?” This type is opaque intentionally, and it is left entirely up to the user if such metadata is needed and present when processing a stream.
- Connection
Stream Read - Connection
Stream Write - Entity
Deserializer - Trait for De-Serializing request entities
- Entity
Serializer - Trait for serializing entities to some bytes.
- Http
Endpoint - Represents a function able to handle a request. It is passed the request and must return a response.
- Into
Connection Stream - Request
Filter - Trait for a filter that may alter a request before its brought to an endpoint. It’s also capable of aborting a request so that it’s not processed further. Use cases: (Non-Exhaustive)
- Response
Body Sink - Response
Filter - Trait for a filter that may alter a Response after an endpoint has been called or a filter has aborted the request. Use cases: (Non-Exhaustive)
- Router
- Trait for a router.
- Router
Filter - Trait for a “filter” that decide if a router is responsible for handling a request. Intended use is to do matching on things like base path, Host HTTP Header, some other magic header.
- Thread
Adapter - Trait that represents a user implemented opaque thread starting/pooling mechanism.
- Websocket
Endpoint - Represents a function able to handle a WebSocket handshake and consequent data frames.
Functions§
- new_
web_ socket_ stream - Creates a new WebSocket receiver sender pair.
Type Aliases§
- Error
Handler - Represents a function able to handle an error.
The first parameter of type
Option<Request>will beSomeif the request could be parsed. Otherwise, it will beNoneand the status code will beStatusCode::BadRequest. - NotFound
Handler - Fallback handler if no router handled the request.
- NotRouteable
Handler - Handler for request that couldn’t route for some reason.
- TiiResult