Crate mini_server

source ·

Macros§

Structs§

  • The HTTPRequest struct represents an HTTP request received by the web server. It encapsulates various components of an HTTP request, including the HTTP method, request path, headers, and body.
  • The HTTPResponse struct represents an HTTP response that the web server can send to clients. It encapsulates various components of an HTTP response, including the response body, headers, status code, status text, and the HTTP version.
  • This struct provide a simple http server that handle many of the use cases

Enums§

  • The HTTPMethod enum represents the HTTP methods that can be used in HTTP requests. Each variant corresponds to a standard HTTP method.
  • A path expression represent a dynamic variable of a path

Constants§

  • CRLF represents the Carriage Return (CR) and Line Feed (LF) characters combined (“\r\n”). It is commonly used as the end-of-line sequence in HTTP requests and responses.
  • MAX_BUFFER defines the maximum size, in bytes, for a request in your web server. Requests exceeding this size may be rejected or handled differently based on your server’s implementation.

Traits§

Type Aliases§

  • EventHandler type is a function type that defines the signature for handling events triggered by HTTP requests. It takes references to an HTTPRequest and a mutable HTTPResponse as parameters.
  • The Headers type alias represents a collection of HTTP headers in key-value pairs. It is implemented as a HashMap<String, String>, where keys are header names, and values are header values.
  • An hash map of PathExpr
  • Vec<u8>
  • RequestHandler type is a function type that defines the signature for handling HTTP requests. It takes HTTPRequest and HashMap<String, PathExpr> as a parameter and returns an HTTPResponse
  • Vec<u8>
  • The SoftEventHandler type is a function type that defines the signature for handling soft events, typically without specific request or response parameters.
  • The URLSearchParams type alias represents a collection of URL parameters parsed from an HTTP request’s query string. It is implemented as a HashMap<String, String> where keys are parameter names, and values are parameter values.