Expand description
The core of TFC is the Context
. To start generating fake input events,
you’ll need to create a context. The context by itself is basically useless
unless you import the traits
. The trait methods return an Error
if
something goes wrong. Bringing these three things together, we end up with
this.
use std::{thread, time::Duration};
use tfc::{Context, Error, traits::*};
fn main() -> Result<(), Error> {
let mut ctx = Context::new()?;
// For OS-specific reasons, it's necessary to wait a moment after
// creating the context before generating events.
thread::sleep(Duration::from_millis(10));
ctx.unicode_string("Hello world!")
}
In addition to the context and its traits, there is also Command
. This
represents an action to perform on the context. It’s possible to serialize a
command, send it over a network, deserialize it and then execute it. In
fact, this is what TFC-server does.
Re-exports
pub use traits::*;
Modules
Structs
The main context used for generating events (Windows).
An iterator for the variants of an
Enum
.Enums
Error enum returned by
Command::from_bytes
.The discriminant of
Command
(useful for serialization).Error enum returned by the
traits
.A keyboard key used by the
KeyboardContext
trait.A mouse button used by the
MouseContext
trait.Traits
An enum with limited reflection capabilities.
Type Definitions
Convenience type alias for
GenericError
.