5 releases

0.1.4 Mar 14, 2025
0.1.3 Feb 24, 2021
0.1.2 Feb 24, 2021
0.1.1 Feb 24, 2021
0.1.0 Apr 10, 2020

#1735 in Procedural macros

Download history 1632/week @ 2024-12-31 1992/week @ 2025-01-07 2023/week @ 2025-01-14 1737/week @ 2025-01-21 2133/week @ 2025-01-28 2607/week @ 2025-02-04 2613/week @ 2025-02-11 2251/week @ 2025-02-18 2174/week @ 2025-02-25 2735/week @ 2025-03-04 3656/week @ 2025-03-11 3375/week @ 2025-03-18 2649/week @ 2025-03-25 2696/week @ 2025-04-01 3147/week @ 2025-04-08 2420/week @ 2025-04-15

11,319 downloads per month
Used in 58 crates (5 directly)

MIT/Apache

18KB
352 lines

ntex macros module

Generators for routes

Route

Macros:

Attributes:

  • "path" - Raw literal string with path for which to register handle. Mandatory.
  • guard = "function_name" - Registers function as guard using ntex::web::guard::fn_guard
  • error = "ErrorRenderer" - Register handler for specified error renderer

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 ntex::web::{get, Error, HttpResponse};
use futures::{future, Future};

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

Macros for ntex::web framework Build Status

Dependencies

~1.5MB
~39K SLoC