//! Trait for user defined hooks
use crate::;
use ;
/// Hooks are user defined functions that recieve a [`Mutex`] over the centralized
/// [`StateMap`]. Events are of different types are called by different sorts
/// of state servers. Hooks are the only way a statemap can be modified, It is recommended
/// that the StateMap be locked at once during the start of the function if it relies
/// on changing the values based on the old value or some other value inside the statemap.
///
/// The `process_event` is the actual function tha should be implemented by a hook function.
/// Init hooks are user defined functions similar to [`Hook`], except that they
/// are not run on Events but they run when the [`StateMap`] is initialized in a server
/// implementation. These run only once and any long running tasks should spawn a thread.
/// If any errors are returned by these, the state map does not get created on the server
/// and instead the implementation should return a response indicating error.