pub struct HookEngine { /* private fields */ }Expand description
Holds all pre-compiled hooks for the lifetime of the server.
Implementations§
Source§impl HookEngine
impl HookEngine
Sourcepub fn new(configs: &[HookConfig]) -> Result<Self>
pub fn new(configs: &[HookConfig]) -> Result<Self>
Compile all hook scripts.
If a script fails to compile and required = false (default), a WARN is
emitted and the hook is skipped. If required = true, compilation failure
returns an error and aborts server startup — use this for security-critical
hooks where a silently-missing hook would leave requests unprotected.
Sourcepub fn run_request_before(&self, ctx: &mut RequestContext) -> HookResult
pub fn run_request_before(&self, ctx: &mut RequestContext) -> HookResult
Run request.before hooks.
Sourcepub fn run_request_error(&self, ctx: &mut RequestContext) -> HookResult
pub fn run_request_error(&self, ctx: &mut RequestContext) -> HookResult
Run request.error hooks.
Sync hooks run inline (critical path) and respect fail_closed /
short-circuit. Async hooks fire-and-forget. Mirrors run_request_before.
Sourcepub fn run_response_headers(&self, ctx: &mut ResponseContext) -> HookResult
pub fn run_response_headers(&self, ctx: &mut ResponseContext) -> HookResult
Run response.headers hooks.
Sourcepub fn run_response_after(&self, ctx: &mut ResponseContext) -> HookResult
pub fn run_response_after(&self, ctx: &mut ResponseContext) -> HookResult
Run response.after hooks.
Trait Implementations§
Source§impl Clone for HookEngine
impl Clone for HookEngine
Source§fn clone(&self) -> HookEngine
fn clone(&self) -> HookEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HookEngine
impl RefUnwindSafe for HookEngine
impl Send for HookEngine
impl Sync for HookEngine
impl Unpin for HookEngine
impl UnsafeUnpin for HookEngine
impl UnwindSafe for HookEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more