Skip to main content

Storage

Trait Storage 

Source
pub trait Storage {
    // Required methods
    fn get(&self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>;
    fn put(&mut self, k: Vec<u8>, v: Vec<u8>) -> Result<(), StorageError>;
    fn remove(&mut self, k: &[u8]) -> Result<(), StorageError>;
}
Expand description

Storge trait.

Required Methods§

Source

fn get(&self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>

Get an entry from the storage.

Source

fn put(&mut self, k: Vec<u8>, v: Vec<u8>) -> Result<(), StorageError>

Put an entry into the storage.

Source

fn remove(&mut self, k: &[u8]) -> Result<(), StorageError>

Remove an entry from the storage.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<K> Storage for DiskStorage<K>
where K: Keydir + KeydirDefault,