pub struct Frame {
pub command: DriveCommand,
pub next_transition_ms: Option<u32>,
pub instruction_index: Option<usize>,
pub finished: bool,
}Expand description
One output frame produced by Runner::poll.
Fields§
§command: DriveCommandDriver command for the current time.
next_transition_ms: Option<u32>Earliest wrapping u32 clock value at which output may change.
While this is Some(deadline), Self::command is guaranteed not to
change before deadline, so the caller may sleep until then. Compare or
wait using wrapping arithmetic rather than absolute < / >. A deadline
equal to the current poll time requests another poll at that same time to
drain an immediate control-flow transition. None means there is no
active or pending transition because the runner is idle or has finished.
instruction_index: Option<usize>Active instruction index in the current cycle.
finished: booltrue only when a finite program has completed.
This is edge-triggered, not a latched state: it is set on the single
Runner::poll that observes the end of the program, which also stops
the runner. Later polls return an idle frame with finished == false.
Act on completion when you first see it rather than polling for it.
Implementations§
Source§impl Frame
impl Frame
Sourcepub const fn is_idle(&self) -> bool
pub const fn is_idle(&self) -> bool
Returns true for an ordinary idle frame with no active instruction.
The one-shot completion frame is not considered idle; it instead reports
Self::is_finished.
Sourcepub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Returns true when a finite program reached the end.
Sourcepub const fn command(&self) -> DriveCommand
pub const fn command(&self) -> DriveCommand
Convenience getter for driver command.
Sourcepub const fn next_transition_ms(&self) -> Option<u32>
pub const fn next_transition_ms(&self) -> Option<u32>
Return the earliest wrapping clock value at which output may change.
See Frame::next_transition_ms for the sleep and same-timestamp polling
contract.