pub struct Mouse { /* private fields */ }Implementations§
Source§impl Mouse
impl Mouse
Sourcepub fn new(device: Device) -> Mouse
pub fn new(device: Device) -> Mouse
Examples found in repository?
examples/mouse_move.rs (line 9)
7fn main() {
8 let device = Device::new("/dev/hidg1");
9 let mouse = Mouse::new(device);
10
11 // Move the mouse to the top left corner
12 mouse.move_zero();
13 sleep(Duration::from_millis(1000));
14
15 // Move the mouse to x100 y100
16 mouse.move_to(100, 100);
17 sleep(Duration::from_millis(1000));
18
19 // Move the mouse relative
20 mouse.move_relative(127, 127);
21 sleep(Duration::from_millis(1000));
22
23 // Perform a right click
24 mouse.right_click();
25 sleep(Duration::from_millis(200));
26}pub fn send_mouse_event( &self, buttons: u8, relative_x: u8, relative_y: u8, vertical_wheel_delta: u8, horizontal_wheel_delta: u8, )
pub fn left_click(&self)
Sourcepub fn right_click(&self)
pub fn right_click(&self)
Examples found in repository?
examples/mouse_move.rs (line 24)
7fn main() {
8 let device = Device::new("/dev/hidg1");
9 let mouse = Mouse::new(device);
10
11 // Move the mouse to the top left corner
12 mouse.move_zero();
13 sleep(Duration::from_millis(1000));
14
15 // Move the mouse to x100 y100
16 mouse.move_to(100, 100);
17 sleep(Duration::from_millis(1000));
18
19 // Move the mouse relative
20 mouse.move_relative(127, 127);
21 sleep(Duration::from_millis(1000));
22
23 // Perform a right click
24 mouse.right_click();
25 sleep(Duration::from_millis(200));
26}Sourcepub fn move_relative(&self, x: i8, y: i8)
pub fn move_relative(&self, x: i8, y: i8)
Examples found in repository?
examples/mouse_move.rs (line 20)
7fn main() {
8 let device = Device::new("/dev/hidg1");
9 let mouse = Mouse::new(device);
10
11 // Move the mouse to the top left corner
12 mouse.move_zero();
13 sleep(Duration::from_millis(1000));
14
15 // Move the mouse to x100 y100
16 mouse.move_to(100, 100);
17 sleep(Duration::from_millis(1000));
18
19 // Move the mouse relative
20 mouse.move_relative(127, 127);
21 sleep(Duration::from_millis(1000));
22
23 // Perform a right click
24 mouse.right_click();
25 sleep(Duration::from_millis(200));
26}Sourcepub fn move_zero(&self)
pub fn move_zero(&self)
Examples found in repository?
examples/mouse_move.rs (line 12)
7fn main() {
8 let device = Device::new("/dev/hidg1");
9 let mouse = Mouse::new(device);
10
11 // Move the mouse to the top left corner
12 mouse.move_zero();
13 sleep(Duration::from_millis(1000));
14
15 // Move the mouse to x100 y100
16 mouse.move_to(100, 100);
17 sleep(Duration::from_millis(1000));
18
19 // Move the mouse relative
20 mouse.move_relative(127, 127);
21 sleep(Duration::from_millis(1000));
22
23 // Perform a right click
24 mouse.right_click();
25 sleep(Duration::from_millis(200));
26}Sourcepub fn move_to(&self, x: u16, y: u16)
pub fn move_to(&self, x: u16, y: u16)
Examples found in repository?
examples/mouse_move.rs (line 16)
7fn main() {
8 let device = Device::new("/dev/hidg1");
9 let mouse = Mouse::new(device);
10
11 // Move the mouse to the top left corner
12 mouse.move_zero();
13 sleep(Duration::from_millis(1000));
14
15 // Move the mouse to x100 y100
16 mouse.move_to(100, 100);
17 sleep(Duration::from_millis(1000));
18
19 // Move the mouse relative
20 mouse.move_relative(127, 127);
21 sleep(Duration::from_millis(1000));
22
23 // Perform a right click
24 mouse.right_click();
25 sleep(Duration::from_millis(200));
26}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