7 releases (1 stable)

Uses new Rust 2024

3.0.0 Jan 2, 2026
0.2.0 Nov 26, 2025
0.1.4 Mar 14, 2025
0.1.3 Feb 24, 2021
0.1.0 Apr 10, 2020

#1722 in Procedural macros

Download history 4047/week @ 2025-09-20 3948/week @ 2025-09-27 3152/week @ 2025-10-04 3018/week @ 2025-10-11 5897/week @ 2025-10-18 3488/week @ 2025-10-25 3492/week @ 2025-11-01 3001/week @ 2025-11-08 5479/week @ 2025-11-15 4790/week @ 2025-11-22 4015/week @ 2025-11-29 3844/week @ 2025-12-06 3638/week @ 2025-12-13 2322/week @ 2025-12-20 2471/week @ 2025-12-27 3765/week @ 2026-01-03

13,142 downloads per month
Used in 76 crates (2 directly)

MIT/Apache

19KB
403 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
~40K SLoC