[][src]Trait tari_mmr::ArrayLikeExt

pub trait ArrayLikeExt {
    type Value;
    fn truncate(&mut self, _len: usize) -> Result<(), MerkleMountainRangeError>;
fn shift(&mut self, n: usize) -> Result<(), MerkleMountainRangeError>;
fn push_front(
        &mut self,
        item: Self::Value
    ) -> Result<(), MerkleMountainRangeError>;
fn for_each<F>(&self, f: F) -> Result<(), MerkleMountainRangeError>
    where
        F: FnMut(Result<Self::Value, MerkleMountainRangeError>)
; }

Associated Types

type Value

Loading content...

Required methods

fn truncate(&mut self, _len: usize) -> Result<(), MerkleMountainRangeError>

Shortens the array, keeping the first len elements and dropping the rest.

fn shift(&mut self, n: usize) -> Result<(), MerkleMountainRangeError>

Shift the array, by discarding the first n elements from the front.

fn push_front(
    &mut self,
    item: Self::Value
) -> Result<(), MerkleMountainRangeError>

Store a new item first in the array, previous items will be shifted up to make room.

fn for_each<F>(&self, f: F) -> Result<(), MerkleMountainRangeError> where
    F: FnMut(Result<Self::Value, MerkleMountainRangeError>), 

Execute the given closure for each value in the array

Loading content...

Implementations on Foreign Types

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

type Value = T

Loading content...

Implementors

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

type Value = T

Loading content...