A simple, safe, and performant preferences library for Rust applications.
Created by Ever Accountable – an app that helps people quit compulsive porn use and become the best version of themselves. More information is available at everaccountable.com.
This library provides an easy-to-use API for reading and writing preferences, using a struct-like interface. The design priorities are:
- Ease of use: Read and write operations are (almost) as simple as setting or getting a struct field.
- Safety: Writes are performed using a temporary file so that crashes won’t leave your data corrupted.
- Performance: Reading and writing are optimized for speed.
- Easy Unit Testing: The library is designed to play well with your unit tests.
Note: This library is NOT intended to store large quantities of data. All data is cached in memory, and the entire file is rewritten on each save. Use a full database for heavy data storage.
Example
use easy_prefs;
easy_prefs!