Struct EventBuffer

Source
pub struct EventBuffer(pub Vec<Event>);
Expand description

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

Tuple Fields§

§0: Vec<Event>

Implementations§

Source§

impl EventBuffer

Source

pub fn new() -> Self

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

Source

pub fn with_capacity(cap: usize) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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

Adds a Press event for the given keylike.

Source

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

Adds a Release event for the given keylike.

Source

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

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

Source

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

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

Source

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

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.

Source

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

Adds a scroll event to the buffer.

Source

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

Uses the mouse wheel vertically.

Source

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

Uses the mouse wheel horizontally.

Source

pub fn simulate(self) -> Result<()>

Simulates the events using the default simulator.

Trait Implementations§

Source§

impl AsMut<Vec<Event>> for EventBuffer

Source§

fn as_mut(&mut self) -> &mut Vec<Event>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<Vec<Event>> for EventBuffer

Source§

fn as_ref(&self) -> &Vec<Event>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for EventBuffer

Source§

fn clone(&self) -> EventBuffer

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for EventBuffer

Source§

fn default() -> EventBuffer

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

impl From<EventBuffer> for Vec<Event>

Source§

fn from(b: EventBuffer) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Event>> for EventBuffer

Source§

fn from(v: Vec<Event>) -> Self

Converts to this type from the input type.
Source§

impl IntoIterator for EventBuffer

Source§

type Item = Event

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Event>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.