pub struct Mouse<'a> { /* private fields */ }Expand description
A struct for controlling a virtual mouse.
It holds a reference to a Device which is used to send the mouse commands.
Implementations§
Source§impl<'a> Mouse<'a>
impl<'a> Mouse<'a>
Sourcepub fn click(&self, button: MouseButton, millis: u64)
pub fn click(&self, button: MouseButton, millis: u64)
Performs a click and release action with a specified button.
The button is pressed, held for millis milliseconds, and then released.
§Arguments
button- TheMouseButtonto click.millis- The duration, in milliseconds, to hold the button down.
Sourcepub fn move_absolute(&self, button: MouseButton, x: u16, y: u16, millis: u64)
pub fn move_absolute(&self, button: MouseButton, x: u16, y: u16, millis: u64)
Moves the mouse cursor to an absolute screen coordinate (x, y) with a simulated smooth movement.
The movement is broken down into smaller steps, with a delay between each step.
§Arguments
button- TheMouseButtonto hold down during the movement (e.g., for dragging). UseMouseButton::Releasefor no buttons.x- The target horizontal coordinate.y- The target vertical coordinate.millis- The delay, in milliseconds, between each small movement step.
Sourcepub fn move_relative(&self, button: MouseButton, x: i8, y: i8)
pub fn move_relative(&self, button: MouseButton, x: i8, y: i8)
Moves the mouse cursor by a relative offset from its current position.
§Arguments
button- TheMouseButtonto hold down during the movement.x- The horizontal offset. Positive values move right, negative move left.y- The vertical offset. Positive values move down, negative move up.
Sourcepub fn press(&self, button: MouseButton)
pub fn press(&self, button: MouseButton)
Presses and holds a specified mouse button.
This method only presses the button; you must call release() to release it.
§Arguments
button- TheMouseButtonto press.
Sourcepub fn release(&self)
pub fn release(&self)
Releases any currently pressed mouse buttons.
This should be called after a press() action to release the button.
Sourcepub fn wheel(&self, button: MouseButton, wheel: i8)
pub fn wheel(&self, button: MouseButton, wheel: i8)
Scrolls the mouse wheel.
§Arguments
button- TheMouseButtonto hold down during the scroll.wheel- The scroll amount. Positive values scroll up, negative values scroll down.
Auto Trait Implementations§
impl<'a> Freeze for Mouse<'a>
impl<'a> RefUnwindSafe for Mouse<'a>
impl<'a> !Send for Mouse<'a>
impl<'a> !Sync for Mouse<'a>
impl<'a> Unpin for Mouse<'a>
impl<'a> UnsafeUnpin for Mouse<'a>
impl<'a> UnwindSafe for Mouse<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more