[][src]Crate actix_web

Actix web is a powerful, pragmatic, and extremely fast web framework for Rust.

Example

use actix_web::{get, web, App, HttpServer, Responder};

#[get("/{id}/{name}/index.html")]
async fn index(info: web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", info.1, info.0)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| App::new().service(index))
        .bind("127.0.0.1:8080")?
        .run()
        .await
}

Documentation & Community Resources

In addition to this API documentation, several other resources are available:

To get started navigating the API docs, you may consider looking at the following pages first:

Features

Crate Features

Re-exports

pub use actix_http::cookie;
pub use actix_rt as rt;

Modules

body
client

Actix web async HTTP client.

dev

The actix-web prelude for library developers

error

Error and Result module

guard

Route match guards.

http

Various HTTP related types

middleware

Middlewares

test

Various helpers for Actix applications to use during testing.

web

Essentials helper functions and types for application registration.

Structs

App

Application builder - structure that follows the builder pattern for building application instances.

Error

General purpose actix web error.

HttpRequest

An HTTP Request

HttpResponse

An HTTP Response

HttpServer

An HTTP Server.

Resource

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

Route

Resource route definition

Scope

Resources scope.

Enums

Either

Combines two different responder types into a single type

Traits

FromRequest

Trait implemented by types that can be extracted from request.

HttpMessage

Trait that implements general purpose operations on http messages

Responder

Trait implemented by types that can be converted to a http response.

ResponseError

Error that can be converted to Response

Type Definitions

Result

A specialized Result for actix web operations

Attribute Macros

connect

Creates route handler with CONNECT method guard.

delete

Creates route handler with DELETE method guard.

get

Creates route handler with GET method guard.

head

Creates route handler with HEAD method guard.

main

Marks async main function as the actix system entry-point.

options

Creates route handler with OPTIONS method guard.

patch

Creates route handler with PATCH method guard.

post

Creates route handler with POST method guard.

put

Creates route handler with PUT method guard.

trace

Creates route handler with TRACE method guard.