Expand description
Proc-macro crate for Arcature.
Provides the attribute/derive macros that power the Arcature developer experience:
#[model(table = "users")]— a SeaORM entity model with the query facade.#[request]— a validated request struct (with#[validate(...)]rules).#[controller]— an Axum controller with route metadata.#[derive(Job)]— a typed background job with aJobModelconst.#[derive(Event)]— a typed in-process event for theDispatcher.#[listener(Event)]— an event listener with dispatch metadata.
Each macro lives in its own file (one file, one macro). This lib.rs is
only the dispatch surface: it declares each macro’s #[proc_macro_*]
entry point and forwards to its implementation module. All expansions
reference Arcature APIs via absolute ::arcature:: paths that resolve in
the downstream app crate. This crate must NOT depend on arcature (would
create a cycle); it depends only on syn, quote, and proc-macro2.
That cycle is also why every example in this crate’s module docs is
tagged ```ignore. The examples show what a developer writes and
what the macro expands to, and both name ::arcature:: items that no
doctest compiled here can resolve. The examples that are compiled live
in arcature itself, on the items these macros generate impls for.
Macros§
- application
application! { pub App { .. } }— seeapplication/mod.rs.- module
module! { pub Accounts { .. } }— seemodule/mod.rs.- page_
macro page_macro!(ShowUserPage { .. })— seepage_macro.rs. Namedpage_macrorather thanpagebecause attribute and function-like macros share one namespace, and#[page("name")]already ownspage.- redirect
redirect!(route::...)— seeredirect.rs.- routes
routes! { pub app { .. } }— seeroutes/mod.rs.
Attribute Macros§
- command
#[command("name")]— seecommand.rs.- controller
#[controller]— seecontroller.rs.- job_
handler #[job_handler]— seejob_handler.rs.- listener
#[listener(Event)]— seelistener.rs.- middleware
#[middleware]— seemiddleware.rs.- model
#[model(table = "users")]— seemodel.rs.- page
#[page("users/show")]— seepage.rs.- policy
#[policy(Model)]— seepolicy.rs.- provider
#[provider]— seeprovider.rs.- request
#[request]— seerequest.rs.- request_
cache #[request_cache(name = "...", key = "...")]— seerequest_cache.rs.- resource
#[resource]— seeresource.rs.- route_
model #[route_model(entity = ..., key_type = ...)]— seeroute_model.rs.- service
#[service]— seeservice.rs.- test
#[arcature::test(app = ...)]— seetest_attr.rs.
Derive Macros§
- DxComponent
#[derive(DxComponent)]— seecomponent.rs.- Event
#[derive(Event)]— seeevent.rs.- Job
#[derive(Job)]— seejob.rs.