[][src]Struct simulate::EventBuffer

pub struct EventBuffer(pub Vec<Event>);

The event buffer is a simple wrapper around a Vec<simulate::Event>.

Implementations

impl EventBuffer[src]

pub fn new() -> Self[src]

Creates a new empty EventBuffer. (see Vec::new)

pub fn with_capacity(cap: usize) -> Self[src]

Creates a new EventBuffer with the given capacity. (see Vec::with_capacity)

pub fn add_event(&mut self, event: Event)[src]

Pushes a new event into the buffer. (see Vec::push)

pub fn extend(&mut self, events: impl IntoIterator<Item = Event>)[src]

Inserts multiple events into the buffer. (see Vec::extend)

pub fn extend_from_slice(&mut self, events: &[Event])[src]

Extends the buffer from a slice of events. (see Vec::extend_from_slice)

pub fn append(&mut self, events: &mut EventBuffer)[src]

Appends the elements of another buffer to this one, living the other one empty. (see Vec::append)

pub fn add_multiple<K: Keylike>(&mut self, keys: impl IntoIterator<Item = K>)[src]

Adds Press and Release events for multiple keylikes into the buffer.

pub fn send(&mut self, key: impl Keylike)[src]

Adds a Press and a Release event for the given keylike.

pub fn press(&mut self, key: impl Keylike)[src]

Adds a Press event for the given keylike.

pub fn release(&mut self, key: impl Keylike)[src]

Adds a Release event for the given keylike.

pub fn type_str(&mut self, s: &str)[src]

Adds Press and Release events for each character of the string.

pub fn move_mouse_relative(&mut self, dx: i32, dy: i32)[src]

Adds an event that causes the mouse to move dx pixels to the right and dy pixels down.

pub fn move_mouse_absolute(&mut self, x: f32, y: f32)[src]

Adds an event that causes the mouse to move, coordinates are normalized to the desktop: (0, 0) map to the top-left of the main monitor and (1, 1) maps to the bottom-right of the main monitor.

pub fn add_scroll_event(&mut self, delta: f32, direction: ScrollDirection)[src]

Adds a scroll event to the buffer.

pub fn scroll(&mut self, delta: f32)[src]

Uses the mouse wheel vertically.

pub fn scroll_horizontal(&mut self, delta: f32)[src]

Uses the mouse wheel horizontally.

pub fn simulate(self) -> Result<()>[src]

Simulates the events using the default simulator.

Trait Implementations

impl AsMut<Vec<Event, Global>> for EventBuffer[src]

impl AsRef<Vec<Event, Global>> for EventBuffer[src]

impl Clone for EventBuffer[src]

impl Default for EventBuffer[src]

impl From<EventBuffer> for Vec<Event>[src]

impl From<Vec<Event, Global>> for EventBuffer[src]

impl IntoIterator for EventBuffer[src]

type Item = Event

The type of the elements being iterated over.

type IntoIter = IntoIter<Event>

Which kind of iterator are we turning this into?

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.