pub struct Mouse { /* private fields */ }Expand description
The Mouse struct that implements the MouseActions
§Example usage
use std::thread;
use std::time::Duration;
use mouce::{Mouse, MouseActions};
fn main() {
let mouse_manager = Mouse::new();
let mut x = 0;
while x < 1920 {
let _ = mouse_manager.move_to(x, 540);
x += 1;
thread::sleep(Duration::from_millis(2));
}
}Implementations§
Trait Implementations§
Source§impl MouseActions for Mouse
impl MouseActions for Mouse
Source§fn move_relative(&self, x_offset: i32, y_offset: i32) -> Result<(), Error>
fn move_relative(&self, x_offset: i32, y_offset: i32) -> Result<(), Error>
Move the mouse relative to the current position in logical pixel space Read more
Source§fn get_position(&self) -> Result<(i32, i32), Error>
fn get_position(&self) -> Result<(i32, i32), Error>
Get the current position of the mouse in logical pixel space Read more
Press down the given mouse button Read more
Release the given mouse button Read more
Click the given mouse button Read more
Source§fn scroll_wheel(
&self,
direction: ScrollDirection,
scroll_unit: ScrollUnit,
distance: u32,
) -> Result<(), Error>
fn scroll_wheel( &self, direction: ScrollDirection, scroll_unit: ScrollUnit, distance: u32, ) -> Result<(), Error>
Scroll the mouse wheel towards to the given direction Read more
Source§fn hook(
&mut self,
callback: Box<dyn Fn(&MouseEvent) + Send>,
) -> Result<CallbackId, Error>
fn hook( &mut self, callback: Box<dyn Fn(&MouseEvent) + Send>, ) -> Result<CallbackId, Error>
Attach a callback function to mouse events Read more
Auto Trait Implementations§
impl Freeze for Mouse
impl RefUnwindSafe for Mouse
impl Send for Mouse
impl !Sync for Mouse
impl Unpin for Mouse
impl UnwindSafe for Mouse
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