Skip to main content
← rust.krizaka.comkrizaka.com

Module settings

Module settings 

Source
Expand description

A small JSON file in the app’s data folder (the scope, the app’s settings), read leniently and written atomically.

A file that is missing or unreadable reads as the default: a damaged settings file never stops the app from opening. A write goes to a temporary file in the same folder, then a rename, so a crash mid-write never leaves half a file.

Enums§

SettingsError
Why a settings file could not be written.

Functions§

load
The value stored in file, or the default when the file is missing or is not that value.
save
Writes value as pretty JSON, atomically (temporary file, fsync, rename), creating the folder if needed.