pub struct HypercallMmr<S = MemoryMmrStore> {
store: S,
size: u64,
}Expand description
Self-contained MMR that owns its store.
Wraps the ckb MMR with its backing store so callers don’t have to manage store lifetimes. Exposes append + peaks_hash. Runtime code can provide a durable store; tests default to the in-memory store.
Fields§
§store: S§size: u64Implementations§
Source§impl<S> HypercallMmr<S>
impl<S> HypercallMmr<S>
pub fn from_store(store: S) -> Result<Self>
pub fn prepare_append_many( &self, data: &[[u8; 32]], ) -> Result<PreparedMmrAppend>
pub fn apply_prepared_append( &mut self, prepared: PreparedMmrAppend, ) -> Result<()>
Sourcepub fn peaks_hash(&self) -> MmrHash
pub fn peaks_hash(&self) -> MmrHash
Get the peaks hash (root commitment).
Returns a zero hash if the MMR is empty.
pub fn size(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for HypercallMmr<S>where
S: Freeze,
impl<S> RefUnwindSafe for HypercallMmr<S>where
S: RefUnwindSafe,
impl<S> Send for HypercallMmr<S>where
S: Send,
impl<S> Sync for HypercallMmr<S>where
S: Sync,
impl<S> Unpin for HypercallMmr<S>where
S: Unpin,
impl<S> UnsafeUnpin for HypercallMmr<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for HypercallMmr<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more