1 unstable release

0.0.1 Jan 19, 2020

#11 in #scrappy

Download history 3/week @ 2023-11-27 1/week @ 2023-12-11 3/week @ 2023-12-18 4/week @ 2024-01-08 13/week @ 2024-02-12 20/week @ 2024-02-19 28/week @ 2024-02-26 26/week @ 2024-03-04 24/week @ 2024-03-11

102 downloads per month
Used in 7 crates (via scrappy)

MIT license

14KB
278 lines

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

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

Dependencies

~1.5MB
~34K SLoC