Medius - Rust LibraryMove

Move

Cursor motion and scroll

One field-generic verb, move_axis, drives the relative axes. move_rel and wheel are thin wrappers over it. Each call queues one fire-and-forget MOVE frame.

You wantMethodSame as
move the cursormove_rel(dx, dy)move_axis(Motion::Cursor { dx, dy })
scroll the wheelwheel(delta)move_axis(Motion::Wheel(dz))

move_axis

Field-generic motion verb
fn move_axis(&self, motion: Motion) -> Result<()>

Fire-and-forget

motion is a Motion: Cursor { dx, dy } for pointer movement or Wheel(dz) for scroll. Backs the MOVE command.

EXAMPLE
use medius::Motion;

device.move_axis(Motion::Cursor { dx: 20, dy: 20 })?; // right and down
device.move_axis(Motion::Wheel(1))?;                  // one notch up

move_rel

Relative cursor movement
fn move_rel(&self, dx: i16, dy: i16) -> Result<()>

Fire-and-forget

A wrapper over move_axis with Motion::Cursor.

PARAMETERS
ParameterTypeDescription
dxi16Horizontal offset in mouse counts. Positive moves right, negative moves left.
dyi16Vertical offset in mouse counts. Positive moves down, negative moves up (screen-style, not math-style).

Offsets are mouse counts, not pixels, scaled by the OS pointer-speed and acceleration curve. Both span the full i16 range (-32768 to 32767).

EXAMPLE
device.move_rel(20, 20)?;  // right and down
device.move_rel(-40, 0)?;  // left
device.move_rel(0, -10)?;  // up

wheel

Wheel scroll
fn wheel(&self, delta: i16) -> Result<()>

Fire-and-forget

A wrapper over move_axis with Motion::Wheel.

PARAMETERS
ParameterTypeDescription
deltai16Scroll steps. Positive scrolls up, negative scrolls down.

delta spans the full i16 range (-32768 to 32767) and feeds the same accumulator as cursor motion, pacing large values across reports.

EXAMPLE
device.wheel(3)?;   // up three notches
device.wheel(-1)?;  // down one notch

On AsyncDevice

Movement stays synchronous

AsyncDevice keeps move_axis, move_rel, and wheel synchronous: no .await, same signatures. The block_on pattern is only for async queries.

EXAMPLE
let dev = Device::find()?.into_async();
dev.move_rel(40, 0)?;  // no .await
dev.wheel(1)?;