Expand description
Persistence: a game’s saves and the player’s settings go through
Storage, so the UI stays pure. The platform supplies the real
implementation (files, the browser’s localStorage, a console’s own
files); MemoryStorage is for tests and the test harness.
Structs§
- Memory
Storage - An in-memory
Storage, for tests and the harness. Nothing persists past the process.
Enums§
- Storage
Error - Why a
Storageoperation failed.
Constants§
- MAX_
KEY_ LEN - Longest key
Storageaccepts, in bytes.
Traits§
- Power
CutRig - A
Storageover a fake of its medium, which can lose the power: what a backend writes to runpower_cut_suite. - Storage
- A place to persist small named blobs of text (RON documents, typically):
files on native,
localStorageon web.
Functions§
- conformance_
suite - A conformance suite every
Storageimplementation must pass, shared by this crate’s own tests and the platforms’ implementations. - is_
valid_ key - Whether
keymatches^[a-z0-9_-]{1,64}$: lowercase ASCII letters, digits,_and-, 1 toMAX_KEY_LENbytes. - power_
cut_ suite - Cuts the power in a write over an old value, a first write and a delete, after each number of operations of the medium in turn, until the operation finishes, and checks what the storage reads after each restart. Panics with the promise broken, the operation and the cut.