Skip to main content

Crate astrea_macro

Crate astrea_macro 

Source
Expand description

Astrea procedural macros

/ Astrea 过程宏

This crate provides the procedural macros used by Astrea:

此 crate 提供 Astrea 使用的宏:

  • [route] - Attribute macro for marking route handlers [route] - 标记路由处理函数的属性宏
  • generate_routes! - Macro for generating routes from filesystem generate_routes! - 从文件系统生成路由的宏

§Example

§示例

// routes/index.get.rs
use astrea::prelude::*;

#[route]
pub async fn handler(event: Event) -> Result<Response> {
    json(json!({"message": "Hello"}))
}

Macros§

generate_routes
Procedural macro to generate routes from filesystem

Attribute Macros§

route
Attribute macro for Astrea route handlers