Crate actix_web [−] [src]
Actix web is a small, pragmatic, extremely fast, web framework for Rust.
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
- User Guide
- Chat on gitter
- GitHub repository
- Cargo package
- Supported Rust version: 1.21 or later
Features
- Supported HTTP/1.x and HTTP/2.0 protocols
- Streaming and pipelining
- Keep-alive and slow requests handling
WebSockets
server/client- Transparent content compression/decompression (br, gzip, deflate)
- Configurable request routing
- Graceful server shutdown
- Multipart streams
- SSL support with openssl or native-tls
- Middlewares (
Logger
,Session
,CORS
,DefaultHeaders
) - Built on top of Actix actor framework.
Reexports
pub use error::Error; |
pub use error::Result; |
pub use error::ResponseError; |
Modules
client |
Http client |
dev |
The |
error |
Error and Result module |
fs |
Static files support. |
headers |
Headers implementation |
httpcodes |
Basic http responses |
middleware |
Middlewares |
multipart |
Multipart requests support |
pred |
Route match predicates |
server |
Http server |
test |
Various helpers for Actix applications to use during testing. |
ws |
|
Structs
Application |
Structure that follows the builder pattern for building |
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 ( |
Version |
Represents a version of the HTTP spec. |
Enums
Binary |
Represents various types of binary body.
|
Body |
Represents various types of http message body. |
Traits
HttpMessage |
Trait that implements general purpose operations on http messages |
Responder |
Trait implemented by types that generate responses for clients. |