jsave
Persist serializable in-memory data in JSON format
Do not use jsave unless you only have a small amount of data. It is not really IO-efficient. Use a proper database like SQLite instead
jsave provides RwLock
, Mutex
and ReentrantMutex
, which are wraps of those in parking_lot, with addition APIs to serialize and store in-memory data to file
Usage
use ;
use ;
// Data to be persisted. Needs to be serializable and deserializable
;
Optional Features
pretty
- Store the data as a pretty-printed String of JSONsend_guard
- Allow lock guards to be sent to other threadspreserve_order
- Read data into a Value and written back to a JSON string while preserving the order of map keys in the inputfloat_roundtrip
- Use sufficient precision when parsing fixed precision floats from JSON to ensure that they maintain accuracy when round-tripped through JSON. This comes at an approximately 2x performance cost for parsing floats compared to the default best-effort precisionarbitrary_precision
- Use an arbitrary precision number representation for serde_json::Number. This allows JSON numbers of arbitrary size/precision to be read into a Number and written back to a JSON string without loss of precisionunbounded_depth
- Provide a method disable_recursion_limit to parse arbitrarily deep JSON structures without any consideration for overflowing the stack
License
GNU General Public License v3.0