pub trait Storage<K, V> where
    V: Clone
{ type Error: Error; fn insert(&mut self, key: &K, value: &V) -> Result<Option<V>, Self::Error>;
fn remove(&mut self, key: &K) -> Result<Option<V>, Self::Error>;
fn get(&'a self, key: &K) -> Result<Option<Cow<'a, V>>, Self::Error>;
fn contains_key(&self, key: &K) -> Result<bool, Self::Error>; }
Expand description

Base map trait for Fuel infrastructure

Generics:

  • K: Key that maps to a value
  • V: Stored value

Associated Types

Error implementation of the storage functions

Required methods

Append K->V mapping to the storage.

If K was already mappped to a value, return the replaced value as Ok(Some(V)). Return Ok(None) otherwise.

Remove K->V mapping from the storage.

Return Ok(Some(V)) if the value was present. If the key wasn’t found, return Ok(None).

Retrieve Cow<V> such as K->V.

Return true if there is a K mapping to a value in the storage.

Implementations on Foreign Types

Implementors