#actix #codegen #web #macros #proc #chat

macro actix-web-codegen

Actix web proc macros

12 releases

✓ Uses Rust 2018 edition

0.2.2 May 23, 2020
0.2.1 Feb 25, 2020
0.2.0 Dec 13, 2019
0.2.0-alpha.1 Nov 22, 2019
0.1.0-alpha.1 Mar 28, 2019
Download history 16305/week @ 2020-03-16 16332/week @ 2020-03-23 16644/week @ 2020-03-30 16223/week @ 2020-04-06 15578/week @ 2020-04-13 16405/week @ 2020-04-20 17768/week @ 2020-04-27 16239/week @ 2020-05-04 17727/week @ 2020-05-11 16238/week @ 2020-05-18 16209/week @ 2020-05-25 19515/week @ 2020-06-01 19036/week @ 2020-06-08 20192/week @ 2020-06-15 21236/week @ 2020-06-22 21026/week @ 2020-06-29

70,621 downloads per month
Used in 213 crates (5 directly)

MIT/Apache

14KB
255 lines

Macros for actix-web framework Build Status codecov crates.io Join the chat at https://gitter.im/actix/actix

Documentation & Resources


lib.rs:

Actix-web codegen module

Generators for routes and scopes

Route

Macros:

Attributes:

  • "path" - Raw literal string with path for which to register handle. Mandatory.
  • guard="function_name" - Registers function as guard using actix_web::guard::fn_guard
  • wrap="Middleware" - Registers a resource middleware.

Notes

Function name can be specified as any expression that is going to be accessible to the generate code (e.g my_guard or my_module::my_guard)

Example:

use actix_web::HttpResponse;
use actix_web_codegen::get;

#[get("/test")]
async fn async_test() -> Result<HttpResponse, actix_web::Error> {
    Ok(HttpResponse::Ok().finish())
}

Dependencies

~380–710KB
~17K SLoC