pub trait StorageBackend: Send + Sync {
// Required methods
fn load(&self) -> Result<BTreeMap<String, String>, String>;
fn write(&self, change: StorageChange) -> Result<(), String>;
}Expand description
Where an app’s entries are kept: the platform’s.
Required Methods§
Sourcefn load(&self) -> Result<BTreeMap<String, String>, String>
fn load(&self) -> Result<BTreeMap<String, String>, String>
The entries kept, read once when the app first uses its storage; an error leaves the app with none (logged).
Sourcefn write(&self, change: StorageChange) -> Result<(), String>
fn write(&self, change: StorageChange) -> Result<(), String>
Keeps change. Called on the engine thread: a backend that blocks
writes elsewhere, in order, and returns before it knows how that
went (logging what fails there). An error means the change was not
kept: a value set is then refused (Storage::set_item fails and
the entries stay as they were); a removal stays done in memory
(logged), as the app asked.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".