gritshield_macros 0.1.0

Procedural attribute routing macros for the GritShield secure web framework.
Documentation
  • Coverage
  • 0%
    0 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 9.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 291.14 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • digiator42

Gritshield Route Macros

A set of convenient procedural macros for defining HTTP routes in Gritshield.

Overview

This crate provides attribute macros (#[get], #[post], #[put], etc.) that automatically register routes using the gritshield::routing::trie system.

Installation

Add this to your Cargo.toml:

[dependencies]

gritshield = { path = "../gritshield" }

Supported Macros

Macro HTTP Method Supports Role
#[get] GET Yes
#[post] POST Yes
#[put] PUT Yes
#[patch] PATCH Yes
#[delete] DELETE Yes

Syntax Options

// Simple path
#[get("/api/hello")]

// With role protection
#[get("/api/secure", role = "Operator")]
#[post("/api/data", role = "Admin")]

How It Works

  • Each macro generates a wrapper function that converts your handler into a BoxFuture.
  • Automatically registers the route using inventory::submit!.
  • Supports optional role-based authorization.

Requirements

  • Your handler must accept gritshield::routing::trie::RequestContext
  • Your handler should return a type that implements IntoResponse