Skip to main content

validate

Function validate 

Source
pub fn validate(step: &ComputerControl, tool: &str) -> Result<(), String>
Expand description

Pointer-step validation: one target form (coordinates XOR element, or neither for up), action-specific fields, drag endpoint pairing.

tool names the calling pipeline in the error messages, so a future consumer reports its own name instead of a hardcoded one.

ยงErrors

Returns Err for a partial coordinate pair, both target forms at once, a targetless action other than up, a leaked element scope (app/pid without selector or vice versa), name and pid together, a 0-based nth/count, a stray anchor, a scroll without deltas, a malformed drag (mixed endpoint forms, missing end point), a count/held/duration_ms/x2/y2/to_selector applied to an action that does not take it, or a duration_ms under MIN_DRAG_MS.