hitbox-derive
Derive macros for the Hitbox caching framework.
This crate provides procedural macros to reduce boilerplate when using hitbox-fn.
Macros
-
#[cached]- Attribute macro that transforms an async function into a cacheable function with a builder-style API for configuring backend, policy, and context. -
#[derive(KeyExtract)]- Derive theKeyExtracttrait for structs to control how they contribute to cache keys. Supports#[key_extract(skip)]and#[key_extract(name = "...")]field attributes. -
#[derive(CacheableResponse)]- Derive theCacheableResponsetrait for return types. Supports#[cacheable_response(skip)]to exclude fields from caching (reconstructed viaDefault). -
#[derive(CacheableRequest)]- Derive theCacheableRequesttrait with standard cache policy logic.
Usage
This crate is typically used through hitbox-fn with the derive feature enabled:
[]
= { = "0.1", = ["derive"] }
use *;
;
async