agent-desktop/crates/core/src/commands/mouse_move.rs
Lahfir 11427b271a refactor!: modernize toolchain to Rust 2024 edition
- Bump workspace edition 2021 → 2024 and MSRV 1.78 → 1.85.
- Add [workspace.lints] block with project-wide rust/clippy policy:
  unsafe_op_in_unsafe_fn warn, unused_must_use deny, dbg_macro deny.
- Migrate all extern "C" blocks to unsafe extern "C" (Edition 2024 req).
- Migrate all #[no_mangle] to #[unsafe(no_mangle)] (Edition 2024 req).
- Wrap unsafe operations inside unsafe fn bodies in explicit unsafe blocks
  via cargo fix.
- Switch RefEntry::path from Vec<usize> to SmallVec<[usize; 8]> with
  serde+union features. Eliminates per-ref heap allocation for typical
  accessibility tree depths (<8) while serializing identically to the
  prior Vec form.
- Strip non-doc-comments from workspace Cargo.toml.

BREAKING CHANGE: minimum supported Rust version is now 1.85. Downstream
consumers building from source must upgrade their toolchain.
2026-05-14 15:14:56 -07:00

23 lines
577 B
Rust

use crate::{
action::{MouseButton, MouseEvent, MouseEventKind, Point},
adapter::PlatformAdapter,
error::AppError,
};
use serde_json::{Value, json};
pub struct MouseMoveArgs {
pub x: f64,
pub y: f64,
}
pub fn execute(args: MouseMoveArgs, adapter: &dyn PlatformAdapter) -> Result<Value, AppError> {
adapter.mouse_event(MouseEvent {
kind: MouseEventKind::Move,
point: Point {
x: args.x,
y: args.y,
},
button: MouseButton::Left,
})?;
Ok(json!({ "moved": true, "x": args.x, "y": args.y }))
}