pub trait CustomAction: Send + Sync {
// Required method
fn run(
&self,
context: &Context,
task_id: MaaId,
node_name: &str,
custom_action_name: &str,
custom_action_param: &str,
reco_id: MaaId,
box_rect: &Rect,
) -> bool;
}Expand description
Trait for implementing custom actions.
Actions are executed after a successful recognition and can perform clicks, swipes, or custom logic.
Required Methods§
Sourcefn run(
&self,
context: &Context,
task_id: MaaId,
node_name: &str,
custom_action_name: &str,
custom_action_param: &str,
reco_id: MaaId,
box_rect: &Rect,
) -> bool
fn run( &self, context: &Context, task_id: MaaId, node_name: &str, custom_action_name: &str, custom_action_param: &str, reco_id: MaaId, box_rect: &Rect, ) -> bool
Execute the custom action.
§Arguments
context- The current execution contexttask_id- ID of the current tasknode_name- Name of the current nodecustom_action_name- Name of this action (as registered)custom_action_param- JSON parameters for this actionreco_id- ID of the preceding recognition resultbox_rect- Target region found by recognition
§Returns
true if the action succeeded, false otherwise