| Crates.io | armature-proc-macro |
| lib.rs | armature-proc-macro |
| version | 0.1.1 |
| created_at | 2025-12-27 00:11:38.687931+00 |
| updated_at | 2025-12-30 22:24:04.260635+00 |
| description | Procedural macros for Armature framework |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006466 |
| size | 103,821 |
Procedural macros for the Armature framework.
This crate provides compile-time attribute macros for defining controllers, routes, and dependency injection.
#[get], #[post], #[put], #[delete], #[patch]#[controller("/path")]#[module(providers: [...], controllers: [...])]#[injectable]#[timeout], #[cache], #[body_limit][dependencies]
armature-proc-macro = "0.1"
use armature_proc_macro::{get, post, controller};
#[controller("/users")]
impl UserController {
#[get("/")]
async fn list(&self) -> Json<Vec<User>> {
// List users
}
#[get("/:id")]
async fn get(&self, id: Path<i32>) -> Json<User> {
// Get user by ID
}
#[post("/")]
async fn create(&self, body: Json<CreateUser>) -> Json<User> {
// Create user
}
}
| Macro | Purpose |
|---|---|
#[controller("/path")] |
Define a controller with base path |
#[module(...)] |
Define a module with providers/controllers |
#[injectable] |
Mark a struct for dependency injection |
#[get("/path")] |
HTTP GET route |
#[post("/path")] |
HTTP POST route |
#[put("/path")] |
HTTP PUT route |
#[delete("/path")] |
HTTP DELETE route |
#[patch("/path")] |
HTTP PATCH route |
#[routes] |
Generate route handlers for a controller |
#[timeout(ms)] |
Set request timeout |
#[cache(ttl)] |
Enable response caching |
#[body_limit(bytes)] |
Set max request body size |
Apache-2.0