pub struct Report<T> {
pub schema: u32,
pub command: Command,
pub captured_utc: Option<String>,
pub polls: Option<u32>,
pub elapsed_ms: Option<u64>,
pub ok: bool,
pub results: Vec<T>,
}Expand description
A command’s answer: the rows it produced, and whether they pass.
Generic over the row type rather than an enum of every command’s shape, so adding a command adds a row type instead of editing a type every existing consumer matches on.
Fields§
§schema: u32§command: Command§captured_utc: Option<String>When the frames behind this answer were taken. Absent for the
commands that do not capture — assert, and resolve without
--relocate. Supplied by the caller; this crate has no clock.
polls: Option<u32>How many times the screen was polled to reach this answer, and how
long that took. Present only for commands that loop — wait — and
provenance in the same sense captured_utc is: they describe how
the answer was obtained, never what it is.
elapsed_ms is measured rather than derived. wait decides when
to stop by counting polls, not by watching a clock, so the two do
not imply each other: capture time is real and is not budgeted.
elapsed_ms: Option<u64>§ok: boolThe aggregate the exit code mirrors: 0 when true, 1 when false.
Each command computes this from its own rows, in its own module. What makes a command report failure is the most important line it has, and it belongs where a reader will look for it rather than in a trait implementation five files away.
results: Vec<T>Implementations§
Source§impl<T> Report<T>
impl<T> Report<T>
Sourcepub fn captured(
command: Command,
captured_utc: String,
ok: bool,
results: Vec<T>,
) -> Self
pub fn captured( command: Command, captured_utc: String, ok: bool, results: Vec<T>, ) -> Self
A document from a command that captured.
Sourcepub fn offline(command: Command, ok: bool, results: Vec<T>) -> Self
pub fn offline(command: Command, ok: bool, results: Vec<T>) -> Self
A document from a command that answered from the session alone.
Sourcepub fn polled(self, polls: u32, elapsed_ms: u64) -> Self
pub fn polled(self, polls: u32, elapsed_ms: u64) -> Self
Record how much polling produced this answer.
Nothing calls this: wait sets polls and elapsed_ms on the
fields directly. Kept for now rather than removed mid-patch,
because dropping a public item from a published crate is a break
and belongs in a minor.