Skip to main content

ActionHandler

Trait ActionHandler 

Source
pub trait ActionHandler: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn invoke(
        &self,
        entity: &HDict,
        action: &str,
        args: &HDict,
    ) -> Result<HGrid, String>;
}
Expand description

A handler for a named action that can be invoked on entities.

Implementors provide:

  • name() — the action name used for dispatch (e.g. "reboot")
  • invoke() — the logic that executes the action

Required Methods§

Source

fn name(&self) -> &str

The action name used for dispatch.

Source

fn invoke( &self, entity: &HDict, action: &str, args: &HDict, ) -> Result<HGrid, String>

Invoke the action on the given entity with the supplied arguments.

  • entity — the resolved entity dict from the graph
  • action — the action name (same as self.name())
  • args — additional arguments from the request grid row

Returns a result grid on success, or a human-readable error string.

Implementors§