pub trait Volatile {
// Required methods
fn get_state_mut(&mut self) -> &mut State;
fn get_state(&self) -> &State;
// Provided methods
fn hash(x: &[u8]) -> [u8; 32] { ... }
fn key_2_state_key<K: Encode>(key: K) -> [u8; 32] { ... }
fn stick_key_with_prefix(key: Bytes, prefix: Bytes) -> Bytes { ... }
fn get<K: Encode>(&self, key: K) -> Option<&Vec<u8>> { ... }
fn cmp<K: Encode>(&self, key: K, cmp_value: Vec<u8>) -> bool { ... }
fn value_2_state_value(value: Vec<u8>) -> Result<Vec<u8>, &'static str> { ... }
fn insert<K: Encode>(
&mut self,
key: K,
val: Vec<u8>
) -> Result<([u8; 32], Vec<u8>), &'static str> { ... }
}