Skip to main content

LocalStorage

Trait LocalStorage 

Source
pub trait LocalStorage {
    // Required methods
    fn set(
        &self,
        key: &str,
        value: &[u8],
        mode: StoreMode,
    ) -> Result<(), LocalStorageError>;
    fn get(
        &self,
        key: &str,
    ) -> Result<Option<(Vec<u8>, u32)>, LocalStorageError>;
    fn delete(&self, key: &str) -> Result<(), LocalStorageError>;
    fn keys(&self) -> Vec<String>;
}
Expand description

The LocalStorage trait defines the methods for storing and retrieving data.

Required Methods§

Source

fn set( &self, key: &str, value: &[u8], mode: StoreMode, ) -> Result<(), LocalStorageError>

Sets the value of a key in the store with the particular StoreMode.

Source

fn get(&self, key: &str) -> Result<Option<(Vec<u8>, u32)>, LocalStorageError>

Retrieves the value of a key from the store.

Source

fn delete(&self, key: &str) -> Result<(), LocalStorageError>

Deletes a key from the store.

Source

fn keys(&self) -> Vec<String>

Returns all the keys in the store.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§