Skip to main content

Crate ashlar_app

Crate ashlar_app 

Source
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
sessionSession<D>: the state commands run on; the host glue (one undo step per command, failed commands change nothing)
runtimeRuntime<D>: one frame (control, jobs, keys, menus, view, dialogs, autosave), repaint policy, Cx for views
driverDriver: a headless, virtual-clock event loop for tests and benches
crashpanic hook, crash logs, last panic, launch guard (from ashlar-log)
loggingstderr + rotating file + in-memory ring (app.logs), directive filters (from ashlar-log)
statsframe-time p50/p95/max (app.stats)
frame_logASHLAR_FRAME_LOG=FILE: one JSON line per frame, size-bounded
perf_warndebug-build stall and same-frame warnings, ASHLAR_FRAME_BUDGET_MS
caretthe text caret’s blink, run on the wake scheduler; solid after a while without input
wakeframe requests with a reason, frames and requests per reason (app.stats → wakes; from ashlar-ui)
telemetryashlar-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-log crate (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 Runtime on 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 (or Runtime::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-log crate (a CLI can use them without the window); re-exported here unchanged. Logging: one log backend writing to stderr (optional), a rotating file in the logs folder and an in-memory ring (what a control method such as app.logs and 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 (or crate::Runtime::record_to) appends one JSON line per frame with its time, screen and input events, and one per control request served, and crate::Driver::replay plays 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 telemetry feature this wraps an ashlar_telemetry::Telemetry (always on when an endpoint is configured: no notice, no switches; TRACER_DISABLED turns 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 named Reason, 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 (see App::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 Driver renders 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 -cli binary.
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.
ViewportFn
Changes the window’s builder before the window opens (see App::viewport).