5 releases

new 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

#2356 in Procedural macros

Download history 2239/week @ 2024-11-22 2174/week @ 2024-11-29 2418/week @ 2024-12-06 1789/week @ 2024-12-13 1367/week @ 2024-12-20 1218/week @ 2024-12-27 1982/week @ 2025-01-03 2131/week @ 2025-01-10 1801/week @ 2025-01-17 1923/week @ 2025-01-24 2465/week @ 2025-01-31 2851/week @ 2025-02-07 1911/week @ 2025-02-14 2295/week @ 2025-02-21 2335/week @ 2025-02-28 2746/week @ 2025-03-07

9,996 downloads per month
Used in 55 crates (5 directly)

MIT/Apache

18KB
352 lines

Macros for ntex::web framework Build Status


lib.rs:

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())
}

Dependencies

~1.5MB
~38K SLoC