Crate ngyn_macros

source ·

Attribute Macros§

  • The check macro is used to determine if a route should be executed. If the gate returns false, the route will not be executed.
  • controller attribute is used to mark a struct as a controller.
  • The delete attribute is used to mark a controller method as a DELETE route.
  • The get attribute is used to mark a controller method as a GET route.
  • The head attribute is used to mark a controller method as a HEAD route.
  • The http_code macro is used to set the default HTTP status code for a route.
  • The inject attribute is used to mark a field as injectable. The field must be a struct that is marked with the [injectable] attribute.
  • injectable attribute is used to mark a struct as injectable.
  • module marks a struct that contains controllers and imports other modules.
  • The patch attribute is used to mark a method of a controller impl as a PATCH route.
  • The post attribute is used to mark a controller method as a POST route.
  • The put attribute is used to mark a controller method as a PUT route.
  • The route attribute is used to mark a method of a controller impl as a route.
  • The routes attribute is used to mark a struct impl as a routes container. The struct must be marked with the [controller] attribute.

Derive Macros§

  • The AppState derive macro is used to derive a struct that can be used as a state in a server.
  • The Dto derive macro is used to generate a DTO struct.
  • The Param derive macro is used to derive a struct that can be used to parse route parameters.
  • The Query derive macro is used to derive a struct that can be used to parse query parameters.