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

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

Rewindable (but still readonly) view of a PMMR.

Methods

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

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

Build a new readonly PMMR.

pub fn backend(&'a self) -> &dyn Backend<T>[src]

Reference to the underlying storage backend.

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

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

pub fn rewind(&mut self, position: u64) -> Result<(), String>[src]

Note: We only rewind the last_pos, we do not rewind the (readonly) backend. Prunable backends are not supported here.

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

Get the data element at provided position in the MMR.

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

Is the MMR empty?

pub fn root(&self) -> Result<Hash, String>[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.

Auto Trait Implementations

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

impl<'a, T, B> Unpin for RewindablePMMR<'a, T, B> where
    T: Unpin

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

impl<'a, T, B> UnwindSafe for RewindablePMMR<'a, T, B> where
    B: RefUnwindSafe,
    T: UnwindSafe

impl<'a, T, B> RefUnwindSafe for RewindablePMMR<'a, T, B> where
    B: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> UnsafeAny for T where
    T: Any

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T