pub async fn run_module<M, C, F, FE, Fut>(
socket_path: impl AsRef<Path>,
module_id: &str,
module_name: &str,
version: &str,
cli_spec: CliSpec,
rpc_methods: &[&str],
event_types: Vec<EventType>,
dispatch: F,
on_event: FE,
module: M,
cli: C,
db: Arc<dyn Database>,
) -> Result<(), ModuleError>where
F: Fn(InvocationMessage, InvocationContext, &M, &C) -> InvocationResultMessage,
FE: Fn(EventMessage, &M, &InvocationContext) -> Fut,
Fut: Future<Output = Result<(), ModuleError>> + Send,Expand description
Run a module with automatic connect, registration, event subscription, and dispatch.
Handles the full lifecycle: connect → register CLI/RPC/events → loop (invocations + events) → unload on disconnect.