Skip to main content

Crate day_script

Crate day_script 

Source
Expand description

day-script: the embedded dayscript engine (DESIGN.md §14). Bind-only-when-invited: the server starts only when DAYSCRIPT_PORT + DAYSCRIPT_TOKEN are present in the environment (never otherwise), listens on 127.0.0.1, and accepts only the step catalog. Steps execute as synthesized Day events on the main thread between flushes, deterministic and toolkit-uniform. Locator steps get an implicit bounded wait (default 5s).

Re-exports§

pub use record::play;

Modules§

conformance
The in-app test runner behind day test (docs/testing.md). The in-app test runner (docs/testing.md): runs the #[day::test] cases the binary registers, each drive op as the dayscript step it names, and answers the tests and run_tests steps day test sends. A run is one main-loop task: between a drive’s awaited ops the app’s loop turns, so a native transition settles and a capture paints exactly as they do between a script’s steps.
png
The PNG reader behind sample_pixel (docs/testing.md). A small PNG reader for the sample_pixel step (docs/testing.md): the in-process capture arrives as PNG bytes, and a test asks for the color of one point of it. It reads the formats a window capture is written in, 8- and 16-bit gray, gray-alpha, RGB and RGBA, non-interlaced, into RGBA8, with its own inflate (RFC 1951) rather than a dependency: this engine is linked into every app, and the reader is a few hundred lines.
record
The dayscript recorder and in-process playback (§14.6): capture the events an app receives back into a replayable dayscript, and replay one against the live UI. See record::start/record::play. The dayscript recorder (DESIGN.md §14.6): the inverse of playback. Where the engine turns a script into synthesized Day events, the recorder turns the events an app receives back into a script. It hooks one point, day_core::set_event_observer, which every backend funnels its native events through (day_core::enqueue_events), so it needs no per-toolkit code, and it emits an ordinary dayscript that replays cross-toolkit through the same executor as any hand-written one.

Structs§

Reply
Request

Enums§

DialogMode
Native UI integration or deterministic Day request/response testing.
Step

Constants§

DEFAULT_MAIN_TIMEOUT_SECS
How long one dispatch may wait for the main thread before the step is failed.
DEFAULT_TIMEOUT_SECS
Default implicit-wait budget, in seconds.

Functions§

b64decode
b64encode
init
Start the engine iff invited via env (call before launch_with; inert otherwise).
step
Run one step on the calling thread, which must be Day’s UI thread with a tree installed: the entry a harness that already sits on that thread (the mock, cargo test) uses instead of the socket.