Skip to main content

Module gateway

Module gateway 

Source
Expand description

Gateway contracts: the ArclyGateway lifecycle trait and the link-time descriptor / runtime types the #[Gateway] macro emits.

§Why no dyn ArclyGateway

ArclyGateway uses native async fn in trait — ergonomic, but not object-safe. We never need a trait object: the #[Gateway] macro generates monomorphic closures over the concrete gateway type (&'static ChatGateway) and type-erases them into GatewayRuntime. This mirrors the framework’s route-thunk pattern and keeps the developer’s trait impl clean.

Structs§

GatewayDescriptor
Link-time gateway registration. One is emitted per #[Gateway] impl and collected via inventory. build constructs the gateway (wiring its Inject<T> fields from the frozen container) and assembles the runtime.
GatewayRuntime
The fully-constructed, ready-to-serve form of a gateway. Produced once at launch by GatewayDescriptor::build and leaked to &'static.

Traits§

ArclyGateway
Connection lifecycle for a real-time gateway.

Type Aliases§

LifecycleHook
A type-erased lifecycle hook closure (built by the macro over a concrete gateway instance).
MessageHandler
A type-erased event handler. Receives the originating client and the raw JSON data payload (as borrowed text), returns the handler’s Result.