[−][src]Struct mouse_rs::winmouse::WinMouse
Struct for the mouse in windows
This struct represents a windows mouse and doesn't hold any values
Implementations
impl WinMouse
[src]
pub fn new() -> WinMouse
[src]
This method creates a new mouse instance, must always be run before anything else
pub fn move_to(&self, x: i32, y: i32) -> Result<(), Box<dyn Error>>
[src]
This method moves the windows mouse around
Examples
use mouse_rs::{ winmouse::WinMouse, types::keys::* }; fn move_mouse() { let mouse = WinMouse::new(); mouse.move_to(500, 500).expect("Unable to move mouse"); }
pub fn press(&self, button: &str) -> Result<(), Box<dyn Error>>
[src]
This method presses the given button in
NOTE: This doesn't release the button so it will keep pressing
Examples
use mouse_rs::{ winmouse::WinMouse, types::keys::* }; fn press_button() { let mouse = WinMouse::new(); mouse.press(LEFT).expect("Unable to press button"); // This will keep pressing } fn press_and_release_button() { let mouse = WinMouse::new(); mouse.press(RIGHT).expect("Unable to press button"); mouse.release(RIGHT).expect("Unable to release button"); // This will press the right mouse quickly }
pub fn release(&self, button: &str) -> Result<(), Box<dyn Error>>
[src]
This will release the button as noted above
pub fn wheel(&self, delta: i32) -> Result<(), Box<dyn Error>>
[src]
This will scroll the mouse,
For scrolling down use negative values, for scrolling up use positive values
Examples
use mouse_rs::{ winmouse::WinMouse, types::keys::* }; fn scroll_up() { let mouse = WinMouse::new(); mouse.wheel(1); } fn scroll_down() { let mouse = WinMouse::new(); mouse.wheel(-1); }
pub fn scroll(&self, delta: i32) -> Result<(), Box<dyn Error>>
[src]
This is the exact same as wheel
Auto Trait Implementations
impl RefUnwindSafe for WinMouse
impl Send for WinMouse
impl Sync for WinMouse
impl Unpin for WinMouse
impl UnwindSafe for WinMouse
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,