Expand description
Registry glue for the real-time macro layer.
§Where the procedural macros actually live
Rust requires procedural (attribute) macros to be defined in a dedicated
proc-macro = true crate — they cannot be authored in a normal library
module. So the implementations of #[Gateway] and #[Subscribe] live in
the arcly-http-macros crate; this module is the runtime landing zone for
the code they emit, and the canonical place to understand that contract.
§What #[Gateway("/path")] expands to
Placed on the gateway’s handler impl block (the same ergonomic rule as
#[Controller], and for the same reason — inventory::submit! cannot be
emitted from inside an impl body), it generates, at module scope:
// 1. A builder that wires the gateway's Inject<T> fields from the frozen
// container (reusing the #[Injectable]-generated __arcly_build), leaks it
// to &'static, and assembles the dispatch table from #[Subscribe] methods.
fn __arcly_build_gateway_CHATGATEWAY(c: &'static FrozenDiContainer)
-> &'static GatewayRuntime { /* ... */ }
// 2. A descriptor + link-time registration.
static __ARCLY_GATEWAY_CHATGATEWAY: GatewayDescriptor = GatewayDescriptor {
name: "ChatGateway", path: "/chat-socket",
build: __arcly_build_gateway_CHATGATEWAY,
};
inventory::submit! { &__ARCLY_GATEWAY_CHATGATEWAY }#[Subscribe("event::name")] is a marker consumed by the enclosing
#[Gateway] walker — it adds one event → handler row to the dispatch
table and is stripped before the impl is re-emitted.
§Aggregation
#[Module(..., gateways(ChatGateway))] records the gateway’s type name in
its ModuleDescriptor. At launch,
App walks the reachable module DAG, and mounts each registered gateway
whose name is in the reachable set — identical encapsulation to controllers.
Functions§
- registered_
gateways - Iterate every link-time-registered gateway descriptor. Used by
Appduring the launch mount pass.