Skip to main content

Step

Enum Step 

Source
pub enum Step {
    Click {
        target: String,
    },
    DoubleClick {
        target: String,
    },
    Type {
        text: String,
    },
    Key {
        chord: String,
    },
    Drag {
        from: String,
        to: String,
    },
    Scroll {
        target: String,
        amount: i32,
        axis: Axis,
    },
    Verify {
        target: String,
    },
    WaitFor {
        target: String,
    },
    WaitGone {
        target: String,
    },
    Changed {
        target: String,
        tolerance: f64,
    },
    Pause {
        ms: u64,
    },
}
Expand description

What a step does.

PartialEq but not Eq: changed’s tolerance is a percentage, and a float has no total equality. Nothing keys a map on a step, so the weaker bound costs nothing.

Variants§

§

Click

Click the resolved point of a labeled region.

Fields

§target: String
§

DoubleClick

Double-click the resolved point of a labeled region.

Fields

§target: String
§

Type

Type literal text through the platform’s Unicode path — layout independent, and unable to express shortcuts (use key).

Fields

§text: String
§

Key

Press a chord of physical keys, e.g. cmd+s.

Fields

§chord: String
§

Drag

Press at one region’s point, move, release at another’s.

Fields

§from: String
§

Scroll

Hover a region and turn the wheel over it.

target picks what to scroll — a wheel event goes to whatever is under the cursor — and resolves exactly like a click’s does. amount is the one quantity in this tool that is not exact: it counts 15° wheel clicks, and how far that moves depends on the reader’s own OS scroll-speed setting. Scroll until something is visible (wait_for), never a fixed distance.

Fields

§target: String
§amount: i32
§axis: Axis
§

Verify

Confirm a labeled region still matches its saved crop.

Fields

§target: String
§

WaitFor

Poll until a labeled region matches its saved crop again, or the timeout expires. The honest alternative to guessing with a sleep: the OS accepts an event long before an app finishes reacting.

Fields

§target: String
§

WaitGone

Poll until a labeled region STOPS matching — “wait until this spinner goes away”, “wait until the button changes state”.

Fields

§target: String
§

Changed

Confirm a labeled region changed — the assertion that proves an action did something, rather than that it was accepted.

verify is the opposite question and answers it with normalized correlation, which is brightness- and contrast-blind: a region that dims uniformly behind a modal still scores ~1.0. This compares RGB directly, so it sees what correlation cannot.

tolerance is the percentage of the region’s masked pixels that must differ before it counts as changed. Zero — any pixel — is the default and the right one for “did anything happen at all”: if the action did nothing, nothing differs. Raise it when something unrelated lives in the region; a text caret blinking inside one is enough to register on its own.

Fields

§target: String
§tolerance: f64
§

Pause

Wait a fixed duration. Present because some waits genuinely have no observable, and pretending otherwise would push people to sleep-and-hope outside the tool.

Fields

§ms: u64

Implementations§

Source§

impl Step

Source

pub fn targets(&self) -> Vec<&str>

Every session label this step needs. Resolution fails before any action runs when one is missing.

Source

pub fn injects(&self) -> bool

Whether this step posts input, as opposed to only looking at the screen.

The distinction decides which regions must be present before a run starts. Acting on a region whose position cannot be trusted clicks an unknown thing; looking for one that is absent is the entire job of wait_for.

Source

pub fn summary(&self) -> String

A short human label for reports and dry-run output.

Trait Implementations§

Source§

impl Clone for Step

Source§

fn clone(&self) -> Step

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Step

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Step

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Step

Source§

fn eq(&self, other: &Step) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Step

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Step

Auto Trait Implementations§

§

impl Freeze for Step

§

impl RefUnwindSafe for Step

§

impl Send for Step

§

impl Sync for Step

§

impl Unpin for Step

§

impl UnsafeUnpin for Step

§

impl UnwindSafe for Step

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.