Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

cargo add ashlar-rs

The package is published as ashlar-rs; the library is imported as ashlar:

use ashlar::prelude::*;

Documents are serialized with serde, so most apps also add it:

cargo add serde --features derive

Feature flags

FeatureDefaultWhat it adds
accesskitonScreen readers and other assistive technology see the window (AccessKit)
headlesson--headless on the app’s command line: no window, .ui scripts, --snap, --tree
native-menuoffThe app’s commands in the macOS and Windows menu bar
trayoffA tray or status-bar icon with a menu (App::tray)
hotkeyoffSystem-wide shortcuts (App::global_shortcut)
telemetryoffCrash, performance and usage reports to a server you host
cargo add ashlar-rs --features native-menu,telemetry

default-features = false drops accesskit and headless for a smaller binary (about 1 MB).

What the umbrella crate contains

ashlar re-exports the layers as modules: ashlar::app, ashlar::command, ashlar::store, ashlar::jobs, ashlar::fs, ashlar::native, ashlar::ui, ashlar::control, ashlar::cli, ashlar::mcp, plus ashlar::egui and ashlar::serde_json. ashlar::prelude has what most apps need: App, Cx, Session, Document, Driver, Effect, CommandSpec, CommandError, Param, Params, cmd!, query!, always, Jobs, apply, Format, Revision, ToastLevel, egui, Value and json!.

Some crates are not re-exported. Add them yourself when you need them:

CrateWhen
ashlar-motionSpring and tween curves for Cx::motion and ashlar::ui::motion
ashlar-diffBuilding the FileDiffs that ashlar::ui::diff_view shows
ashlar-debug.ui script reports and golden snapshots in tests (usually a dev-dependency)
ashlar-native with notifySystem notifications

Each ashlar-* crate also works on its own. A headless tool that only needs documents and undo can depend on ashlar-store alone.

Linux build dependencies

Debian and Ubuntu package names:

sudo apt-get install libgtk-3-dev libxdo-dev libxkbcommon-dev libdbus-1-dev

Binary size

The smallest app (examples/hello) is 13.6 MB stripped in a release build on macOS arm64. A profile with fat LTO, one codegen unit, opt-level = "s" and stripping brings it to 9.0 MB:

[profile.release-small]
inherits = "release"
lto = "fat"
codegen-units = 1
opt-level = "s"
strip = true
cargo build --profile release-small