pub struct Hook {
pub event: HookEventName,
pub matcher: Option<String>,
pub timeout: Duration,
pub status_message: Option<String>,
pub if_condition: Option<String>,
pub once: bool,
pub kind: HookKind,
}Expand description
SDK hook definition registered into a builder.
Fields§
§event: HookEventName§matcher: Option<String>§timeout: Duration§status_message: Option<String>§if_condition: Option<String>§once: bool§kind: HookKindImplementations§
Source§impl Hook
impl Hook
Sourcepub fn callback<F, Fut, R>(event: HookEventName, callback: F) -> Self
pub fn callback<F, Fut, R>(event: HookEventName, callback: F) -> Self
Create a callback hook for an event.
Sourcepub fn function<Factory, F, Fut, R>(
event: HookEventName,
factory: Factory,
) -> Self
pub fn function<Factory, F, Fut, R>( event: HookEventName, factory: Factory, ) -> Self
Create a hook that builds its callback per dispatch.
Sourcepub fn with_matcher(self, matcher: impl Into<String>) -> Self
pub fn with_matcher(self, matcher: impl Into<String>) -> Self
Restrict the hook to matching event values.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Override the hook timeout.
Sourcepub fn with_status_message(self, status_message: impl Into<String>) -> Self
pub fn with_status_message(self, status_message: impl Into<String>) -> Self
Set the status message shown while the hook runs.
Sourcepub fn with_if_condition(self, if_condition: impl Into<String>) -> Self
pub fn with_if_condition(self, if_condition: impl Into<String>) -> Self
Set a simple hook condition expression.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Hook
impl !UnwindSafe for Hook
impl Freeze for Hook
impl Send for Hook
impl Sync for Hook
impl Unpin for Hook
impl UnsafeUnpin for Hook
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