pub struct Input(/* private fields */);
Expand description
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§
Source§impl Input
impl Input
Sourcepub fn from_motion(motion: MouseMotion) -> Self
pub fn from_motion(motion: MouseMotion) -> Self
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]);
Sourcepub fn from_wheel(motion: f32, direction: WheelDirection) -> Self
pub fn from_wheel(motion: f32, direction: WheelDirection) -> Self
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 Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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