pub struct Noct { /* private fields */ }Expand description
The main struct for handling the event emitting
Implementations§
Source§impl Noct
impl Noct
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
More examples
examples/keyboard.rs (line 7)
5fn main() {
6 thread::sleep(Duration::from_secs(2));
7 let mut noct = Noct::new();
8
9 // write text
10 noct.key_sequence("Hello World! here is a lot of text ❤️");
11
12 // select all
13 noct.key_down(Key::Control);
14 noct.key_click(Key::Layout('a'));
15 noct.key_up(Key::Control);
16}examples/timer.rs (line 8)
6fn main() {
7 thread::sleep(Duration::from_secs(2));
8 let mut noct = Noct::new();
9
10 let now = Instant::now();
11
12 // write text
13 noct.key_sequence("Hello World! ❤️");
14
15 let time = now.elapsed();
16 println!("{:?}", time);
17
18 // select all
19 noct.key_down(Key::Control);
20 noct.key_click(Key::Layout('a'));
21 noct.key_up(Key::Control);
22}examples/mouse.rs (line 7)
5fn main() {
6 let wait_time = Duration::from_secs(2);
7 let mut noct = Noct::new();
8
9 thread::sleep(wait_time);
10
11 noct.mouse_move_to(500, 200);
12 thread::sleep(wait_time);
13
14 noct.mouse_down(MouseButton::Left);
15 thread::sleep(wait_time);
16
17 noct.mouse_move_relative(100, 100);
18 thread::sleep(wait_time);
19
20 noct.mouse_up(MouseButton::Left);
21 thread::sleep(wait_time);
22
23 noct.mouse_click(MouseButton::Left);
24 thread::sleep(wait_time);
25
26 noct.mouse_scroll_x(2);
27 thread::sleep(wait_time);
28
29 noct.mouse_scroll_x(-2);
30 thread::sleep(wait_time);
31
32 noct.mouse_scroll_y(2);
33 thread::sleep(wait_time);
34
35 noct.mouse_scroll_y(-2);
36 thread::sleep(wait_time);
37}Trait Implementations§
Source§impl KeyboardControllable for Noct
impl KeyboardControllable for Noct
Source§fn key_sequence(&mut self, sequence: &str)
fn key_sequence(&mut self, sequence: &str)
Types the string Read more
Source§fn key_sequence_parse(&mut self, sequence: &str)where
Self: Sized,
fn key_sequence_parse(&mut self, sequence: &str)where
Self: Sized,
Types the string parsed with DSL. Read more
Source§fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), ParseError>where
Self: Sized,
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), ParseError>where
Self: Sized,
Same as key_sequence_parse except returns any errors
Source§impl MouseControllable for Noct
impl MouseControllable for Noct
Source§fn mouse_move_to(&mut self, x: i32, y: i32)
fn mouse_move_to(&mut self, x: i32, y: i32)
Lets the mouse cursor move to the specified x and y coordinates. Read more
Source§fn mouse_move_relative(&mut self, x: i32, y: i32)
fn mouse_move_relative(&mut self, x: i32, y: i32)
Lets the mouse cursor move the specified amount in the x and y
direction. Read more
Source§fn mouse_down(&mut self, button: MouseButton)
fn mouse_down(&mut self, button: MouseButton)
Push down one of the mouse buttons Read more
Source§fn mouse_up(&mut self, button: MouseButton)
fn mouse_up(&mut self, button: MouseButton)
Lift up a pushed down mouse button Read more
Source§fn mouse_click(&mut self, button: MouseButton)
fn mouse_click(&mut self, button: MouseButton)
Click a mouse button Read more
Source§fn mouse_scroll_x(&mut self, length: i32)
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)
fn mouse_scroll_y(&mut self, length: i32)
Scroll the mouse (wheel) up or down Read more
impl Send for Noct
Auto Trait Implementations§
impl Freeze for Noct
impl RefUnwindSafe for Noct
impl !Sync for Noct
impl Unpin for Noct
impl UnwindSafe for Noct
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