Thanks to visit codestin.com
Credit goes to docs.rs

Crate tii

Crate tii 

Source
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§

AcceptQualityMimeType
Represents one part of an accept mime
Cookie
Represents an HTTP cookie as in the Cookie header.
HttpHeader
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.
RequestBody
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.
RequestContext
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.
ResponseBody
ResponseBodySinkAsWrite
ResponseContext
Context object for response filters Contains both info of the request and response
RouteBuilder
Builder for a route/endpoint.
Routeable
Encapsulates a route and its handler.
RouterBuilder
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.
ServerBuilder
Represents the Tii app.
SetCookie
Represents an HTTP cookie as in the Set-Cookie header.
ThreadAdapterJoinHandle
Represents an opaque join handle
TypeSystem
Holds an immutable type system containing casting information
TypeSystemBuilder
Builder for the type system
WebsocketReceiver
Receiving side of a web socket
WebsocketSender
Sending side of a web socket

Enums§

AcceptMimeType
Version of MimeType that can contain “*” symbols.
HttpHeaderName
Represents a header received in a request. TODO implement to &str fn to prevent clone on serialization!
HttpMethod
Represents an HTTP method.
HttpVersion
Enum for http versions tii supports.
InvalidPathError
MimeGroup
Mime types are split into groups denoted by whatever is before of the “/”
MimeType
Represents a MIME type as used in the Content-Type header.
ReadMessageTimeoutResult
Return enum for the fn WebsocketReceiver::read_message_timeout
RequestHeadParsingError
RouterWebSocketServingResponse
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
RoutingDecision
Enum that shows information on how a particular request could be routed on a route.
SameSite
Represents the SameSite value of the cookie.
StatusCode
Represents an HTTP status code.
TiiError
TypeSystemError
Errors that can occur when dynamic types have to be handled
UserError
WebsocketMessage
Represents a WebSocket message.

Traits§

ConnectionStream
This represents a raw stream source the server can use to server requests to. Each instance of this represents a dedicated client connection.
ConnectionStreamMetadata
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.
ConnectionStreamRead
ConnectionStreamWrite
EntityDeserializer
Trait for De-Serializing request entities
EntitySerializer
Trait for serializing entities to some bytes.
HttpEndpoint
Represents a function able to handle a request. It is passed the request and must return a response.
IntoConnectionStream
RequestFilter
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)
ResponseBodySink
ResponseFilter
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.
RouterFilter
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.
ThreadAdapter
Trait that represents a user implemented opaque thread starting/pooling mechanism.
WebsocketEndpoint
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§

ErrorHandler
Represents a function able to handle an error. The first parameter of type Option<Request> will be Some if the request could be parsed. Otherwise, it will be None and the status code will be StatusCode::BadRequest.
NotFoundHandler
Fallback handler if no router handled the request.
NotRouteableHandler
Handler for request that couldn’t route for some reason.
TiiResult