[−][src]Struct winput::Input
This structure is used by send_inputs
to store information for synthesizing input
events such as keystrokes, mouse movement, and mouse clicks.
Example
use winput::{Input, Action}; let input = Input::from_char('A', Action::Press); winput::send_inputs(&[input]);
Implementations
impl Input
[src]
pub fn from_char(c: char, action: Action) -> Option<Input>
[src]
Creates an Input
that causes the given action to be taken on the given
character. If the given character is above 0x0000ffff
, None
is returned.
Example
use winput::{Input, Action}; let input = Input::from_char('A', Action::Press).unwrap(); winput::send_inputs(&[input]);
pub fn from_vk(vk: Vk, action: Action) -> Input
[src]
Creates an Input
that causes the given action to be taken on the given
Virtual-Key Code.
Example
use winput::{Input, Action, Vk}; let input = Input::from_vk(Vk::Enter, Action::Press); winput::send_inputs(&[input]);
pub fn from_button(button: Button, action: Action) -> Input
[src]
Creates an Input
that causes the given action to be taken on the given mouse
button.
Example
use winput::{Button, Action, Input}; let input = Input::from_button(Button::Left, Action::Press); winput::send_inputs(&[input]);
pub fn from_motion(motion: MouseMotion) -> Self
[src]
Creates an Input
that causes the mouse to move according to the given
MouseMotion
.
Example
use winput::{MouseMotion, Input}; let motion = MouseMotion::Relative { dx: 100, // 100 pixels right dy: 50, // 50 pixels down }; let input = Input::from_motion(motion); winput::send_inputs(&[input]);
pub fn from_wheel(motion: f32, direction: WheelDirection) -> Self
[src]
Creates an Input
that causes the mouse wheel to rotate by the given amount and
in the given WheelDirection
.
When the given direction is vertical, a positive motion means the wheel rotates forward, away from the user; a negative value means the wheel rotates backward, toward the user.
When the given direction is horizontal, a positive motion means the wheel rotates to the right; a negative value means the wheel rotates to the left.
Example
use winput::{WheelDirection, Input}; let input = Input::from_wheel(100.0, WheelDirection::Vertical); winput::send_inputs(&[input]);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Input
[src]
impl Send for Input
[src]
impl Sync for Input
[src]
impl Unpin for Input
[src]
impl UnwindSafe for Input
[src]
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,