Crate actix_web [] [src]

Actix web is a small, fast, pragmatic, open source rust web framework.

use actix_web::*;

fn index(req: HttpRequest) -> String {
    format!("Hello {}!", &req.match_info()["name"])
}

fn main() {
    HttpServer::new(
        || Application::new()
            .resource("/{name}", |r| r.f(index)))
        .bind("127.0.0.1:8080").unwrap()
        .run();
}

Documentation

Features

  • Supported HTTP/1.x and HTTP/2.0 protocols
  • Streaming and pipelining
  • Keep-alive and slow requests handling
  • WebSockets
  • Transparent content compression/decompression (br, gzip, deflate)
  • Configurable request routing
  • Multipart streams
  • Middlewares (Logger, Session, DefaultHeaders)
  • Graceful server shutdown
  • Built on top of Actix.

Reexports

pub use error::Error;
pub use error::Result;
pub use error::ResponseError;

Modules

dev

The actix-web prelude for library developers

error

Error and Result module

fs

Static files support.

headers

Headers implementation

httpcodes

Basic http responses

middleware

Middlewares

multipart

Multipart requests support

payload

Payload stream

pred

Route match predicates

server

Http server

test

Various helpers for Actix applications to use during testing.

ws

WebSocket support for Actix

Structs

Application

Structure that follows the builder pattern for building Application structs.

HttpContext

Http actor execution context

HttpRequest

An HTTP Request

HttpResponse

An HTTP Response

HttpServer

An HTTP Server

Json

Json response helper

Method

The Request Method (VERB)

NormalizePath

Path normalization helper

Reply

Represents response process.

Resource

Resource is an entry in route table which corresponds to requested URL.

Route

Resource route definition

StatusCode

An HTTP status code (status-code in RFC 7230 et al.).

Version

Represents a version of the HTTP spec.

Enums

Binary

Represents various types of binary body. Content-Length header is set to length of the body.

Body

Represents various types of http message body.

Traits

Responder

Trait implemented by types that generate responses for clients.