1 unstable release

0.1.0 Apr 22, 2020

#170 in #routes

Download history 4/week @ 2024-11-13 1/week @ 2024-11-20 2/week @ 2024-12-04 9/week @ 2024-12-11 1/week @ 2024-12-18 72/week @ 2025-02-05 4/week @ 2025-02-12 8/week @ 2025-02-19 17/week @ 2025-02-26

101 downloads per month

MIT/Apache

14KB
254 lines

Macros for actix-web framework

Fork of https://github.com/actix/actix-web/tree/master/actix-web-codegen

Build Status codecov 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
  • wrap=Middleware - Registers a ressource 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;
use futures::{future, Future};

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

Dependencies

~1.5MB
~38K SLoC