pub struct InputMacro { /* private fields */ }Expand description
A recorded sequence of input events with timing.
An InputMacro captures events and their relative timing so they can
be replayed deterministically through a ProgramSimulator.
Implementations§
Source§impl InputMacro
impl InputMacro
Sourcepub fn new(events: Vec<TimedEvent>, metadata: MacroMetadata) -> Self
pub fn new(events: Vec<TimedEvent>, metadata: MacroMetadata) -> Self
Create a new macro from events and metadata.
Sourcepub fn from_events(name: impl Into<String>, events: Vec<Event>) -> Self
pub fn from_events(name: impl Into<String>, events: Vec<Event>) -> Self
Create a macro from events with no timing (all zero delay).
Useful for building test macros programmatically.
Sourcepub fn events(&self) -> &[TimedEvent]
pub fn events(&self) -> &[TimedEvent]
Get the recorded events.
Sourcepub fn metadata(&self) -> &MacroMetadata
pub fn metadata(&self) -> &MacroMetadata
Get the metadata.
Sourcepub fn total_duration(&self) -> Duration
pub fn total_duration(&self) -> Duration
Get the total duration of the recording.
Sourcepub fn bare_events(&self) -> Vec<Event>
pub fn bare_events(&self) -> Vec<Event>
Extract just the events (without timing) in order.
Sourcepub fn replay_with_timing<M: Model>(&self, sim: &mut ProgramSimulator<M>)
pub fn replay_with_timing<M: Model>(&self, sim: &mut ProgramSimulator<M>)
Replay this macro through a simulator, honoring recorded delays.
Sourcepub fn replay_with_sleeper<M, F>(&self, sim: &mut ProgramSimulator<M>, sleep: F)
pub fn replay_with_sleeper<M, F>(&self, sim: &mut ProgramSimulator<M>, sleep: F)
Replay this macro through a simulator with a custom sleep function.
Useful for tests that want deterministic timing without wall-clock sleep.
Trait Implementations§
Source§impl Clone for InputMacro
impl Clone for InputMacro
Source§fn clone(&self) -> InputMacro
fn clone(&self) -> InputMacro
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InputMacro
impl RefUnwindSafe for InputMacro
impl Send for InputMacro
impl Sync for InputMacro
impl Unpin for InputMacro
impl UnsafeUnpin for InputMacro
impl UnwindSafe for InputMacro
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