inkpad_support/traits/storage.rs
1//! Storage trait
2use inkpad_std::Vec;
3
4/// Storage trait
5pub trait Storage {
6 /// set K for V
7 fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Option<Vec<u8>>;
8
9 /// get V by K
10 ///
11 /// use `Vec<u8>` as return because some implementation
12 /// is hard to return `&[u8]`
13 fn get(&self, key: &[u8]) -> Option<Vec<u8>>;
14
15 /// Remove a key
16 fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>;
17}