[][src]Trait geen::Storage

pub trait Storage {
    type Value;
    type Error: Error;
    fn len(&self) -> Result<usize, Self::Error>;
fn push(&mut self, item: Self::Value) -> Result<usize, Self::Error>;
fn get(&self, index: usize) -> Result<Option<Self::Value>, Self::Error>;
fn get_or_panic(&self, index: usize) -> Self::Value;
fn clear(&mut self) -> Result<(), Self::Error>; }

A trait describing generic array-like behaviour, without imposing any specific details on how this is actually done.

Associated Types

type Value

type Error: Error

Loading content...

Required methods

fn len(&self) -> Result<usize, Self::Error>

Returns the number of hashes stored in the backend

fn push(&mut self, item: Self::Value) -> Result<usize, Self::Error>

Store a new item and return the index of the stored item

fn get(&self, index: usize) -> Result<Option<Self::Value>, Self::Error>

Return the item at the given index

fn get_or_panic(&self, index: usize) -> Self::Value

Return the item at the given index. Use this if you know that the index is valid. Requesting a hash for an invalid index may cause the a panic

fn clear(&mut self) -> Result<(), Self::Error>

Remove all stored items from the the backend.

Loading content...

Implementations on Foreign Types

impl<T: Clone> Storage for Vec<T>[src]

type Error = GeneError

type Value = T

Loading content...

Implementors

impl Storage for PrunedHashSet[src]

type Error = GeneError

type Value = H256

Loading content...