use futures::future::BoxFuture;
use std::fmt;
use std::fmt::{Debug, Formatter};
pub type SyncHook = dyn FnMut() + Send + Sync + 'static;
pub trait SyncHookTrait: FnMut() + Send + Sync + 'static {}
impl<T> SyncHookTrait for T where T: FnMut() + Send + Sync + 'static {}
pub type AsyncHook = dyn Fn() -> BoxFuture<'static, ()> + Send + Sync + 'static;
pub trait AsyncHookTrait: Fn() -> BoxFuture<'static, ()> + Send + Sync + 'static {}
impl<T> AsyncHookTrait for T where T: Fn() -> BoxFuture<'static, ()> + Send + Sync + 'static {}
pub enum Hook {
Sync(Box<SyncHook>),
Async(Box<AsyncHook>),
}
impl Debug for Hook {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Hook::Sync(_) => write!(f, "Hook::Sync"),
Hook::Async(_) => write!(f, "Hook::Async"),
}
}
}