Skip to main content

Module splash_core

Module splash_core 

Source
Expand description

Shared startup-splash timeline logic: the row model, event application with same-tick count-up deferral, a frozen-row finalizer, duration formatting, and total/other reconciliation — used identically by all three platform splash renderers (splash.rs Windows, splash_mac.rs macOS, splash_linux/ Linux).

WHY THIS EXISTS NOW, NOT EARLIER. Before this module, each platform reimplemented this exact logic from scratch — splash_mac.rs’s own doc comment explained why at the time: “editing two already-working splashes I cannot build or run to verify” was too risky for the PR that first needed a macOS stage panel. The predictable result (see docs/reports/REPORT_SPLASH_SCREEN_ARCHITECTURE_RETHINK_2026_09_14.md §1): the same-tick count-up deferral fix landed only on macOS, the frozen-row defect (a row whose End never arrives stays visually “running” forever once the render loop stops redrawing on a timer) was never fixed on ANY platform — including macOS, despite it having the count-up fix — and total/other reconciliation existed only on macOS, as a bare unreconciled "total:" line on Windows and not at all on Linux. Three independent implementations meant every fix needed to land three times, and in practice none of them ever did.

Platform-specific compositing (Win32 GDI blitting, Cocoa NSTextField layout, X11/Wayland pixel buffers) stays in each platform’s own file — only the pure logic (no FFI, no windowing, no Instant mocking needed) lives here, which is also what makes it unit-testable without a live window on any platform, including the two this was written on without being able to run them.

Structs§

Row
StageEntry
StageTimeline
The full timeline: every stage/sub-item seen so far, plus the state the same-tick deferral needs to carry between calls.
SubEntry

Enums§

BeginKey 🔒
Identifies which row a Begin event created, so the same-tick deferral in apply_tick can recognize an End for a row created in the very same batch.
RowKind
What one rendered line stands for. Platform renderers match on this and draw it their own way (GDI text, an NSTextField pair, a formatted string) — the selection of what to draw is shared, which is the part that was wrong in three places independently.

Constants§

SUB_DETAIL_MAX
How many of a stage’s sub-items are rendered individually. Anything older collapses into a single tally row.

Functions§

tally_label
The label for a collapsed-sub-items row. Shared so all three platforms word it identically.
trunc
Truncates to max chars, appending .. when it does. Char-based (not byte-based) so it never splits a multi-byte codepoint.
visible_rows
Flatten stages into at most budget rows: summarize each stage’s older sub-items into a tally, then — if that still doesn’t fit — keep the newest rows rather than the oldest.

Type Aliases§

Outcome
A completed sub-item or stage’s outcome: elapsed ms, status, and an optional short annotation carried over from the originating event.