Today — Recording exposes frames(), len(), is_empty(), dropped(), to_asciicast() and write_asciicast(). Measured on 0.10.1 (grep 'pub fn' inside impl Recording): there is no duration(), so a test asking how long an animation took writes
let took = recording.frames().last().map(|(at, _)| *at).unwrap_or_default();
Why it is worth fixing — "did this redraw finish within X?" is one of the two questions a recording is for (the other is the frame sequence itself), and len() already exists for the other one. The asciicast header has a duration field this would also feed (see #309).
Fix — add Recording::duration(&self) -> Duration in crates/termlens/src/terminal.rs, returning the timestamp of the last frame (zero when empty). Its rustdoc should say what the span is measured between — the recorder starting and the last complete frame — since that is not the same as the process's lifetime.
Done when
A good first contribution: one file, no architecture decisions. Start with
CONTRIBUTING.md
— §1 lists every gate you can run locally, and §3 asks that a change land
with a test. Commits are Conventional Commits and need git commit -s
(DCO). Happy to review a draft PR early.
Today —
Recordingexposesframes(),len(),is_empty(),dropped(),to_asciicast()andwrite_asciicast(). Measured on 0.10.1 (grep 'pub fn'insideimpl Recording): there is noduration(), so a test asking how long an animation took writesWhy it is worth fixing — "did this redraw finish within X?" is one of the two questions a recording is for (the other is the frame sequence itself), and
len()already exists for the other one. The asciicast header has adurationfield this would also feed (see #309).Fix — add
Recording::duration(&self) -> Durationincrates/termlens/src/terminal.rs, returning the timestamp of the last frame (zero when empty). Its rustdoc should say what the span is measured between — the recorder starting and the last complete frame — since that is not the same as the process's lifetime.Done when
duration()exists, documented, returning zero for an empty recording.crates/termlens/tests/record.rsasserts it is monotonic with the last frame's timestamp.A good first contribution: one file, no architecture decisions. Start with
CONTRIBUTING.md
— §1 lists every gate you can run locally, and §3 asks that a change land
with a test. Commits are Conventional Commits and need
git commit -s(DCO). Happy to review a draft PR early.