pub enum HookType {
PanicHook(Option<isize>),
RequestMiddleware(Option<isize>),
Route(&'static str),
ResponseMiddleware(Option<isize>),
}Expand description
Represents different kinds of hooks in the server lifecycle.
Each variant corresponds to a specific hook that can be registered
and triggered at different stages of request handling or server events.
Hooks with an Option<isize> allow specifying a priority order; None indicates
the default order (0 or unspecified).
Variants§
PanicHook(Option<isize>)
Triggered when a panic occurs in the server.
Option<isize>- Optional priority of the panic hook.Nonemeans default.
RequestMiddleware(Option<isize>)
Executed before a request reaches its designated route handler.
Option<isize>- Optional priority of the request middleware.
Route(&'static str)
Represents a route handler for a specific path.
&'static str- The route path handled by this hook.
ResponseMiddleware(Option<isize>)
Executed after a route handler but before the response is sent.
Option<isize>- Optional priority of the response middleware.
Implementations§
Source§impl HookType
Implementation block for HookType.
impl HookType
Implementation block for HookType.
This block defines utility methods associated with the HookType enum.
These methods provide additional functionality for working with hooks,
such as extracting the execution order (priority) used in duplicate checks.
Sourcepub fn try_get(&self) -> Option<isize>
pub fn try_get(&self) -> Option<isize>
Returns the optional execution priority (order) of a hook.
Hooks that carry an order indicate their execution priority.
Hooks without an order are considered unordered and are ignored in duplicate checks.
§Returns
Option<isize>-Some(order)if the hook defines a priority, otherwiseNone.