pub struct TextSynchronousProxy { /* private fields */ }
Implementations§
source§impl TextSynchronousProxy
impl TextSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
sourcepub fn wait_for_event(&self, deadline: Time) -> Result<TextEvent, Error>
pub fn wait_for_event(&self, deadline: Time) -> Result<TextEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
sourcepub fn send_(&self, text: &str, ___deadline: Time) -> Result<(), Error>
pub fn send_(&self, text: &str, ___deadline: Time) -> Result<(), Error>
Sends text
through the input pipeline, pretending to be a keyboard,
effectively converting the text into key presses as if on a US QWERTY
keyboard, and typing characters up one at a time with a brief pause
between successive key events.
US ASCII text get mapped to the corresponding key presses.
For example a
gets mapped into a press and
a followup release of the key a
on the US QWERTY keyboard. Also,
A
gets mapped into a press of the Shift
key, followed by a press
and release of a
.
For convenience, the \n
and \t
get converted into Enter
and Tab
keys respectively.
On error-free return, the caller can assume that all keys corresponding
to text
has been typed up on the fake keyboard. On error, the caller
should fail the test.
This API does not support sending multiple key events at the same time.
Feel free to expose the appropriate functionality from the
input-synthesis
library if you need that.