pub trait PlatformStorage {
// Required methods
fn storage_get(&self, key: &str) -> Option<String>;
fn storage_set(
&mut self,
key: &str,
value: &str,
) -> Result<(), PlatformError>;
fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>;
fn storage_clear(&mut self) -> Result<(), PlatformError>;
}Expand description
Unified key-value local storage contract shared across Web, Mobile, HarmonyOS, Wearables, Mini-Programs, and QuickApps.
Required Methods§
Sourcefn storage_get(&self, key: &str) -> Option<String>
fn storage_get(&self, key: &str) -> Option<String>
Sourcefn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
Sourcefn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
Sourcefn storage_clear(&mut self) -> Result<(), PlatformError>
fn storage_clear(&mut self) -> Result<(), PlatformError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl PlatformStorage for HarmonyPlatform
PlatformStorage implementation for HarmonyPlatform.
impl PlatformStorage for MiniAppPlatform
PlatformStorage implementation for MiniAppPlatform.
impl PlatformStorage for QuickAppPlatform
PlatformStorage implementation backed by @system.storage commands.
impl PlatformStorage for TerminalPlatform
PlatformStorage implementation for TerminalPlatform.
impl PlatformStorage for WearablePlatform
PlatformStorage implementation for WearablePlatform.