Spikard. LifecycleHooksConfig
(spikard v0.17.0)
Copy Markdown
Per-route selection of registered lifecycle hooks.
ServerConfig.lifecycle_hooks holds Arc<dyn LifecycleHook> function pointers and is marked
#[serde(skip)] / #[alef(skip)] because closures cannot be serialized or cross the FFI
boundary. A per-route field with that same shape would be invisible to alef, and therefore
invisible to every binding — defeating the purpose of exposing it here. This descriptor
carries [LifecycleHookRef] entries instead: each one names a registered hook (plus its
declared dependencies and optional config), so a later enforcement phase can resolve those
names against the server's registered LifecycleHooks and run the matches for this route. The
five fields mirror the five hook phases documented in the tower-middleware-and-lifecycle
project convention (onRequest, preValidation, preHandler, onResponse, onError).
Summary
Types
@type t() :: %Spikard.LifecycleHooksConfig{ on_error: [Spikard.LifecycleHookRef.t()], on_request: [Spikard.LifecycleHookRef.t()], on_response: [Spikard.LifecycleHookRef.t()], pre_handler: [Spikard.LifecycleHookRef.t()], pre_validation: [Spikard.LifecycleHookRef.t()] }
Per-route selection of registered lifecycle hooks.