Skip to main content

Crate ashlar_fs

Crate ashlar_fs 

Source
Expand description

Files and settings: app dirs, durable atomic writes, keyed settings, recent files.

  • AppDirs: where an app keeps its config, data, cache and logs on each OS.
  • atomic_write: replace a file so a crash or power cut leaves the old or the new content, never a torn mix.
  • ConfigStore / FileOps: the storage seen by settings, autosave and recovery, with disk and in-memory backends (browser storage plugs in here).
  • Settings: keyed JSON with typed getters, a schema version and a debounced durable save.
  • RecentFiles: a most-recently-used list.

Headless and wasm32-clean: on the web the disk backends compile but report errors; use the in-memory ones or a browser-storage backend.

Re-exports§

pub use atomic::atomic_write;
pub use atomic::atomic_write_with;
pub use backend::ConfigStore;
pub use backend::DirConfig;
pub use backend::FileOps;
pub use backend::MemFiles;
pub use backend::MemoryConfig;
pub use backend::StdFiles;
pub use dirs::AppDirs;
pub use recent::RecentFiles;
pub use settings::LoadState;
pub use settings::Settings;
pub use settings::SettingsMigration;

Modules§

atomic
Crash-safe file replacement.
backend
Where small persistent files live. Code that keeps settings, keymaps or a session sentinel sees only these traits; the app picks the backend: a folder on disk (DirConfig, StdFiles), memory for tests and headless runs (MemoryConfig, MemFiles), or browser storage (OPFS) on the web, added later as another implementation.
dirs
Per-app directories (config, data, cache, logs) in the places each OS expects.
recent
A most-recently-used list of files (File ▸ Open Recent).
settings
Keyed JSON settings with a schema version and a debounced, durable save.