pub struct HookConfig {
pub pre_request: Vec<String>,
pub post_request: Vec<String>,
pub post_request_failure: Vec<String>,
}Expand description
Hook configuration declared under [package.metadata.app.hooks] in
the app’s Cargo.toml.
§Example
[package.metadata.app.hooks]
pre_request = ["./scripts/rate_limit.sh"]
post_request = ["./scripts/log_request.sh"]
post_request_failure = ["./scripts/alert_on_failure.sh"]Fields§
§pre_request: Vec<String>Commands to run before the resource handler. Exit 0 = allow, exit 2 = deny, other = hook failure.
post_request: Vec<String>Commands to run after a successful resource handler invocation. Fire-and-forget; results do not affect the response.
post_request_failure: Vec<String>Commands to run after a failed resource handler invocation. Fire-and-forget; results do not affect the response.
Implementations§
Trait Implementations§
Source§impl Clone for HookConfig
impl Clone for HookConfig
Source§fn clone(&self) -> HookConfig
fn clone(&self) -> HookConfig
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 moreSource§impl Debug for HookConfig
impl Debug for HookConfig
Source§impl Default for HookConfig
impl Default for HookConfig
Source§fn default() -> HookConfig
fn default() -> HookConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for HookConfig
impl<'de> Deserialize<'de> for HookConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HookConfig
impl RefUnwindSafe for HookConfig
impl Send for HookConfig
impl Sync for HookConfig
impl Unpin for HookConfig
impl UnsafeUnpin for HookConfig
impl UnwindSafe for HookConfig
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