[][src]Struct grin_core::core::pmmr::ReadonlyPMMR

pub struct ReadonlyPMMR<'a, T, B> where
    T: PMMRable,
    B: Backend<T>, 
{ /* fields omitted */ }

Readonly view of a PMMR.

Methods

impl<'a, T, B> ReadonlyPMMR<'a, T, B> where
    T: PMMRable,
    B: 'a + Backend<T>, 
[src]

pub fn new(backend: &'a B) -> ReadonlyPMMR<T, B>[src]

Build a new readonly PMMR.

pub fn at(backend: &'a B, last_pos: u64) -> ReadonlyPMMR<T, B>[src]

Build a new readonly PMMR pre-initialized to last_pos with the provided backend.

pub fn get_data(&self, pos: u64) -> Option<T::E>[src]

Get the data element at provided position in the MMR.

pub fn get_hash(&self, pos: u64) -> Option<Hash>[src]

Get the hash at provided position in the MMR.

pub fn is_empty(&self) -> bool[src]

Is the MMR empty?

pub fn root(&self) -> Hash[src]

Computes the root of the MMR. Find all the peaks in the current tree and "bags" them to get a single peak.

pub fn peaks(&self) -> Vec<Hash>[src]

Returns a vec of the peaks of this MMR.

pub fn unpruned_size(&self) -> u64[src]

Total size of the tree, including intermediary nodes and ignoring any pruning.

pub fn elements_from_insertion_index(
    &self,
    index: u64,
    max_count: u64
) -> (u64, Vec<T::E>)
[src]

Helper function which returns un-pruned nodes from the insertion index forward returns last insertion index returned along with data

pub fn get_last_n_insertions(&self, n: u64) -> Vec<(Hash, T::E)>[src]

Helper function to get the last N nodes inserted, i.e. the last n nodes along the bottom of the tree. May return less than n items if the MMR has been pruned/compacted.

Auto Trait Implementations

impl<'a, T, B> Send for ReadonlyPMMR<'a, T, B> where
    B: Sync,
    T: Send

impl<'a, T, B> Sync for ReadonlyPMMR<'a, T, B> where
    B: Sync,
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self