Struct enigo::Enigo

source ·
pub struct Enigo;
Expand description

The main struct for handling the event emitting

Implementations§

source§

impl Enigo

source

pub fn new() -> Self

Constructs a new Enigo instance.

Example
use enigo::*;
let mut enigo = Enigo::new();

Trait Implementations§

source§

impl Debug for Enigo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Enigo

source§

fn default() -> Enigo

Returns the “default value” for a type. Read more
source§

impl KeyboardControllable for Enigo

source§

fn key_sequence(&mut self, sequence: &str)

Enter the text. You can use unicode here like: ❤️. This works regardless of the current keyboardlayout. You cannot use this function for entering shortcuts or something similar. For shortcuts, use the KeyboardControllable::key_click method instead. Read more
source§

fn key_click(&mut self, key: Key)

Press and release the key. It is the same as calling the KeyboardControllable::key_down and KeyboardControllable::key_up functions consecutively
source§

fn key_down(&mut self, key: Key)

Press down the given key
source§

fn key_up(&mut self, key: Key)

Release a pressed down key
source§

fn key_sequence_parse(&mut self, sequence: &str)where Self: Sized,

Type the string parsed with DSL. Read more
source§

fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), ParseError>where Self: Sized,

Same as KeyboardControllable::key_sequence_parse except returns any errors Read more
source§

impl MouseControllable for Enigo

source§

fn mouse_move_to(&mut self, x: i32, y: i32)

Move the mouse cursor to the specified x and y coordinates. Read more
source§

fn mouse_move_relative(&mut self, x: i32, y: i32)

Move the mouse cursor the specified amount in the x and y direction. A positive x value moves the mouse cursor x pixels to the right. A negative value for x moves the mouse cursor to the left. A positive value of y moves the mouse cursor down, a negative one moves the mouse cursor up. Read more
source§

fn mouse_down(&mut self, button: MouseButton)

Push down the mouse button specified by the parameter button of type MouseButton and hold it until it is released by MouseControllable::mouse_up. Calls to MouseControllable::mouse_move_to or MouseControllable::mouse_move_relative will work like expected and will e.g. drag widgets or highlight text. Read more
source§

fn mouse_up(&mut self, button: MouseButton)

Release a pushed down mouse button Read more
source§

fn mouse_click(&mut self, button: MouseButton)

Click a mouse button Read more
source§

fn mouse_scroll_x(&mut self, length: i32)

Scroll the mouse (wheel) left or right Read more
source§

fn mouse_scroll_y(&mut self, length: i32)

Scroll the mouse (wheel) up or down Read more
source§

fn main_display_size(&self) -> (i32, i32)

Get the (width, height) of the main display in screen coordinates (pixels). This currently only works on the main display Read more
source§

fn mouse_location(&self) -> (i32, i32)

Get the location of the mouse in screen coordinates (pixels). Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Enigo

§

impl Send for Enigo

§

impl Sync for Enigo

§

impl Unpin for Enigo

§

impl UnwindSafe for Enigo

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.