2 releases

0.2.0 Jan 18, 2020

#147 in #routes

Download history 3/week @ 2023-12-08 10/week @ 2023-12-15 9/week @ 2023-12-22 6/week @ 2024-01-05 6/week @ 2024-01-12 4/week @ 2024-01-19 1/week @ 2024-01-26 2/week @ 2024-02-02 14/week @ 2024-02-09 27/week @ 2024-02-16 33/week @ 2024-02-23 30/week @ 2024-03-01 26/week @ 2024-03-08 20/week @ 2024-03-15 13/week @ 2024-03-22

95 downloads per month
Used in 8 crates (via requiem-web)

MIT/Apache

15KB
278 lines

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


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

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;
use futures::{future, Future};

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

Dependencies

~1.5MB
~33K SLoC