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]) -> Self
pub fn new(configs: &[HookConfig]) -> Self
Compile all hook scripts. Scripts that fail to compile are skipped with a WARN log; the server starts normally regardless.
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: &RequestContext)
pub fn run_request_error(&self, ctx: &RequestContext)
Run request.error hooks — all spawned as async; no short-circuit.
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