Struct winput::Mouse[][src]

pub struct Mouse;

A zero-sized structure that wraps functions related to the mouse.

Implementations

impl Mouse[src]

pub fn position() -> Result<(i32, i32), WindowsError>[src]

Retrieve the current position of the mouse, in screen coordinates.

Example

use winput::Mouse;

println!("The mouse is at {:?}", Mouse::position());

pub fn set_position(x: i32, y: i32) -> Result<(), WindowsError>[src]

Sets the position of the mouse, in screen coordinates.

Example

use winput::{Vk, Mouse};

Mouse::set_position(50, 50).unwrap();

pub fn scroll(amount: f32)[src]

Synthesizes a vertical scroll event.

If the function fails to synthesize the input, no error is emited and the function fails silently. If you wish to retreive an eventual error, use send_inputs instead.

Example

use winput::Mouse;

Mouse::scroll(1.0).unwrap();

pub fn scrollh(amount: f32)[src]

Synthesizes a horizontal scroll event.

If the function fails to synthesize the input, no error is emited and the function fails silently. If you wish to retreive an eventual error, use send_inputs instead.

Example

use winput::Mouse;

Mouse::scrollh(1.0).unwrap();

pub fn move_relative(dx: i32, dy: i32)[src]

Moves the mouse relatively to its current position, in screen coordinates.

If the function fails to synthesize the input, no error is emited and the function fails silently. If you wish to retreive an eventual error, use send_inputs instead.

Example

use winput::Mouse;

Mouse::move_relative(100, 50).unwrap();

pub fn move_absolute(x: f32, y: f32)[src]

Moves the mouse using absolute normalized coordinates.

If the function fails to synthesize the input, no error is emited and the function fails silently. If you wish to retreive an eventual error, use send_inputs instead.

Example

use winput::Mouse;

// Move the mouse in the center of the main monitor.
Mouse::move_absolute(0.5, 0.5).unwrap();

Auto Trait Implementations

impl RefUnwindSafe for Mouse

impl Send for Mouse

impl Sync for Mouse

impl Unpin for Mouse

impl UnwindSafe for Mouse

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.