diff options
Diffstat (limited to 'crates/system_action/src/action_pool.rs')
| -rw-r--r-- | crates/system_action/src/action_pool.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/crates/system_action/src/action_pool.rs b/crates/system_action/src/action_pool.rs index c3ad4a1..019fa6d 100644 --- a/crates/system_action/src/action_pool.rs +++ b/crates/system_action/src/action_pool.rs @@ -15,7 +15,25 @@ type ProcEndCallback = fn() -> ProcEndFuture; type ProcBeginFuture<'a> = Pin<Box<dyn Future<Output = Result<(), TcpTargetError>> + Send + 'a>>; type ProcEndFuture = Pin<Box<dyn Future<Output = Result<(), TcpTargetError>> + Send>>; -/// A pool of registered actions that can be processed by name +/// # Struct - ActionPool +/// +/// This struct is used to register and record all accessible and executable actions +/// +/// It also registers `on_proc_begin` and `on_proc_end` callback functions +/// used for action initialization +/// +/// ## Creating and registering actions +/// ```ignore +/// fn init_action_pool() { +/// let mut pool = Action::new(); +/// +/// // Register action +/// pool.register<YourAction, ActionArgument, ActionReturn>(); +/// +/// // If the action is implemented with `#[action_gen]`, you can also do +/// register_your_action(&mut pool); +/// } +/// ``` pub struct ActionPool { /// HashMap storing action name to action implementation mapping actions: std::collections::HashMap<&'static str, Box<dyn ActionErased>>, |
