pub enum Hook<M: Manager> {
Fn(Box<dyn Fn(&mut <M as Manager>::Type, &Metrics) -> HookResult<<M as Manager>::Error> + Sync + Send>),
AsyncFn(Box<dyn for<'a> Fn(&'a mut <M as Manager>::Type, &'a Metrics) -> HookFuture<'a, <M as Manager>::Error> + Sync + Send>),
}
Expand description
Wrapper for hook functions
Variants§
Fn(Box<dyn Fn(&mut <M as Manager>::Type, &Metrics) -> HookResult<<M as Manager>::Error> + Sync + Send>)
Use a plain function (non-async) as a hook
AsyncFn(Box<dyn for<'a> Fn(&'a mut <M as Manager>::Type, &'a Metrics) -> HookFuture<'a, <M as Manager>::Error> + Sync + Send>)
Use an async function as a hook
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for Hook<M>
impl<M> !RefUnwindSafe for Hook<M>
impl<M> Send for Hook<M>
impl<M> Sync for Hook<M>
impl<M> Unpin for Hook<M>
impl<M> !UnwindSafe for Hook<M>
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