Trait tari_mmr::ArrayLike[][src]

pub trait ArrayLike {
    type Value;
    type Error: Error;
    fn len(&self) -> Result<usize, Self::Error>;
fn is_empty(&self) -> Result<bool, 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 clear(&mut self) -> Result<(), Self::Error>;
fn position(&self, item: &Self::Value) -> Result<Option<usize>, Self::Error>; }

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

Associated Types

Loading content...

Required methods

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

Returns the number of hashes stored in the backend

fn is_empty(&self) -> Result<bool, Self::Error>[src]

Returns if empty

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

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

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

Return the item at the given index

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

Remove all stored items from the the backend.

fn position(&self, item: &Self::Value) -> Result<Option<usize>, Self::Error>[src]

Finds the index of the specified stored item, it will return None if the object could not be found.

Loading content...

Implementations on Foreign Types

impl<T: Clone + PartialEq> ArrayLike for Vec<T>[src]

type Error = MerkleMountainRangeError

type Value = T

Loading content...

Implementors

impl ArrayLike for PrunedHashSet[src]

type Error = MerkleMountainRangeError

type Value = Hash

impl<T: Clone + PartialEq> ArrayLike for MemBackendVec<T>[src]

type Error = MerkleMountainRangeError

type Value = T

Loading content...