pub struct ScriptedHost {
pub tick: u64,
pub frames: Vec<Vec<(SenseId, Signal)>>,
pub commands: Vec<HostCommand>,
pub commands_per_tick: Vec<usize>,
}Expand description
Scripted senses + recorded apply commands for deterministic replay tests.
Hold dense SenseIds resolved after bind. Each frame is a write list
(not a full port snapshot) applied in sample_into when
HostTime.tick == frame_index. Missing sense keys hold last value
(runtime does not clear senses each frame). Ticks past frames.len()
write nothing (last values remain). Prefer setting every sense every frame
in tests so scripts stay explicit.
After each tick, commands grows with that frame’s outbox mapping.
Fields§
§tick: u64Current frame index for Host::time (incremented in Host::apply).
frames: Vec<Vec<(SenseId, Signal)>>Write list for sample when tick == i (before apply increments tick).
commands: Vec<HostCommand>Flattened HostCommand history (append-only across ticks).
commands_per_tick: Vec<usize>Per-tick command counts (for slicing commands).
Implementations§
Source§impl ScriptedHost
impl ScriptedHost
Sourcepub fn push_frame(
&mut self,
senses: impl IntoIterator<Item = (SenseId, Signal)>,
)
pub fn push_frame( &mut self, senses: impl IntoIterator<Item = (SenseId, Signal)>, )
Push one frame of dense sense writes (order preserved).
Sourcepub fn last_commands(&self) -> &[HostCommand]
pub fn last_commands(&self) -> &[HostCommand]
Commands applied on the last completed tick (after tick_once).
Trait Implementations§
Source§impl Clone for ScriptedHost
impl Clone for ScriptedHost
Source§fn clone(&self) -> ScriptedHost
fn clone(&self) -> ScriptedHost
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptedHost
impl Debug for ScriptedHost
Source§impl Default for ScriptedHost
impl Default for ScriptedHost
Source§fn default() -> ScriptedHost
fn default() -> ScriptedHost
Source§impl Host for ScriptedHost
impl Host for ScriptedHost
Source§fn time(&self) -> HostTime
fn time(&self) -> HostTime
Runtime::begin_frame.Source§fn sample_into(&mut self, ports: &mut PortWriter<'_>) -> Result<(), HandleError>
fn sample_into(&mut self, ports: &mut PortWriter<'_>) -> Result<(), HandleError>
set_sense only).