Expand description
ashlar runtime: the App builder, the frame scheduler, crash guard, logging, telemetry and
agent control.
An app declares its document type and Format, its commands
(fn(&mut Session<D>, &Value)) and a view; App::run opens the window and gives it undo and
redo (one step per top-level command), save / open / autosave and crash recovery, menus, a
keymap editor and command palette, a crash guard and log files, the agent control port, and
telemetry when enabled. App::cli / cli_main serve the same commands as a CLI and MCP
server; App::headless and Driver run them in tests.
| Module | |
|---|---|
session | Session<D>: the state commands run on; the host glue (one undo step per command, failed commands change nothing) |
runtime | Runtime<D>: one frame (control, jobs, keys, menus, view, dialogs, autosave), repaint policy, Cx for views |
driver | Driver: a headless, virtual-clock event loop for tests and benches |
crash | panic hook, crash logs, last panic, launch guard (from ashlar-log) |
logging | stderr + rotating file + in-memory ring (app.logs), directive filters (from ashlar-log) |
stats | frame-time p50/p95/max (app.stats) |
frame_log | ASHLAR_FRAME_LOG=FILE: one JSON line per frame, size-bounded |
perf_warn | debug-build stall and same-frame warnings, ASHLAR_FRAME_BUDGET_MS |
caret | the text caret’s blink, run on the wake scheduler; solid after a while without input |
wake | frame requests with a reason, frames and requests per reason (app.stats → wakes; from ashlar-ui) |
telemetry | ashlar-telemetry hook points (feature telemetry) |
Re-exports§
pub use driver::Driver;pub use runtime::Cx;pub use runtime::FilePicker;pub use runtime::Pick;pub use runtime::Runtime;pub use session::Document;pub use session::Effect;pub use session::Origin;pub use session::Session;pub use stats::FrameStats;pub use stats::LaunchTimes;pub use stats::StatsSummary;
Modules§
- caret
- The text caret’s blink, run by the runtime instead of egui.
- crash
- Logging and crash safety live in the headless
ashlar-logcrate (a CLI can use them without the window); re-exported here unchanged. Crash safety: a panic hook that writes a crash log and keeps the last panic for display, and a launch guard that notices when the previous launch died before its first frame. - driver
- A headless event loop for tests and benches: runs a
Runtimeon an egui context without a window, the way eframe does, on a virtual clock. A frame runs only when something asked for one (input,request_repaint, a repaint timer), so tests can prove that an idle app draws nothing. - frame_
log ASHLAR_FRAME_LOG=FILE(orRuntime::log_frames): one JSON line per egui pass, for profiling a real app run by run.- logging
- Logging and crash safety live in the headless
ashlar-logcrate (a CLI can use them without the window); re-exported here unchanged. Logging: onelogbackend writing to stderr (optional), a rotating file in the logs folder and an in-memory ring (what a control method such asapp.logsand crash logs read). - perf_
warn - Perf warnings for development builds, and the per-frame probe that feeds them and the frame
log (
crate::frame_log). - record
- Record and replay a session’s input:
ASHLAR_RECORD=path(orcrate::Runtime::record_to) appends one JSON line per frame with its time, screen and input events, and one per control request served, andcrate::Driver::replayplays such a file into a fresh driver. - runtime
- The runtime: one frame of an app (control requests, jobs, autosave, menus, keys, the view, dialogs), the repaint policy, and the eframe glue.
- session
- The session: the state every command runs on (document, file, view state), and the host glue that makes each top-level command exactly one undo step.
- stats
- Frame-time statistics: how long producing each frame took (logic + UI, not the time between frames, which is unbounded for an app that repaints on demand).
- telemetry
- Telemetry hook points. With the
telemetryfeature this wraps anashlar_telemetry::Telemetry(always on when an endpoint is configured: no notice, no switches;TRACER_DISABLEDturns it off); without it every call is an empty inline function. - wake
- The frame scheduler lives in
ashlar-ui(it needs only egui, so hosts without the runtime use it too); re-exported here unchanged. The frame scheduler: ask for frames with a namedReason, so an app can say why each frame ran. - window_
state - Where the window was: saved in the settings under
"window"and restored on the next launch (seeApp::remember_window).
Structs§
- App
- An app: name, document type and format, commands, views.
run()opens the window; the same definition serves the CLI and MCP (App::cli) and tests (App::headless). - Forwarded
- What a second launch sent.
- Headless
- A session of an app without a window: what the CLI, MCP and tests drive. Implements
Dispatch; effects that need a window are dropped (toasts are logged). - Renderer
- How a
Driverrenders screenshots. Cheap to clone (the device is shared).
Enums§
- Error
- Why the app could not start.
Functions§
- cli_
main fn main() -> ExitCode { ashlar_app::cli_main(my_app::app()) }: an app’s-clibinary.- control_
methods - Methods the windowed runtime answers on the control port besides the standard ones.
Type Aliases§
- SetupFn
- Runs once with the egui context before the first frame (fonts, tokens).
- ViewFn
- A view: draws the app’s UI each frame.
- Viewport
Fn - Changes the window’s builder before the window opens (see
App::viewport).