Skip to main content

Crate arcature_macros

Crate arcature_macros 

Source
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 a JobModel const.
  • #[derive(Event)] — a typed in-process event for the Dispatcher.
  • #[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 { .. } } — see application/mod.rs.
module
module! { pub Accounts { .. } } — see module/mod.rs.
page_macro
page_macro!(ShowUserPage { .. }) — see page_macro.rs. Named page_macro rather than page because attribute and function-like macros share one namespace, and #[page("name")] already owns page.
redirect
redirect!(route::...) — see redirect.rs.
routes
routes! { pub app { .. } } — see routes/mod.rs.

Attribute Macros§

command
#[command("name")] — see command.rs.
controller
#[controller] — see controller.rs.
job_handler
#[job_handler] — see job_handler.rs.
listener
#[listener(Event)] — see listener.rs.
middleware
#[middleware] — see middleware.rs.
model
#[model(table = "users")] — see model.rs.
page
#[page("users/show")] — see page.rs.
policy
#[policy(Model)] — see policy.rs.
provider
#[provider] — see provider.rs.
request
#[request] — see request.rs.
request_cache
#[request_cache(name = "...", key = "...")] — see request_cache.rs.
resource
#[resource] — see resource.rs.
route_model
#[route_model(entity = ..., key_type = ...)] — see route_model.rs.
service
#[service] — see service.rs.
test
#[arcature::test(app = ...)] — see test_attr.rs.

Derive Macros§

DxComponent
#[derive(DxComponent)] — see component.rs.
Event
#[derive(Event)] — see event.rs.
Job
#[derive(Job)] — see job.rs.