Skip to main content

DataStorage

Trait DataStorage 

Source
pub trait DataStorage {
    // Required methods
    fn get(&self, key: &str) -> Result<String, StorageError>;
    fn set(&mut self, key: &str, value: &str) -> Result<(), StorageError>;
    fn remove(&mut self, key: &str) -> Result<(), StorageError>;
}
Expand description

The DataStorage trait allows access to a persistent storage. Each module has it’s own DataStorage, so there will never be a name clash.

Required Methods§

Source

fn get(&self, key: &str) -> Result<String, StorageError>

Source

fn set(&mut self, key: &str, value: &str) -> Result<(), StorageError>

Source

fn remove(&mut self, key: &str) -> Result<(), StorageError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§