pub struct ProofEncoder { /* private fields */ }
Expand description
An encoder that manages a reverse buffer which can be used to convert the
root-to-leaf ordering of the TreeWalker
to the proper stack ordering.
Implementations§
Source§impl ProofEncoder
impl ProofEncoder
Sourcepub fn new(n: usize) -> Self
pub fn new(n: usize) -> Self
Create a new proof encoder for encoding a tree with the provided max number of
items. An instance of ProofEncoder can not be used to encode more than the n
items specified here. Providing an n
smaller than the actual number of nodes
can result in panics.
Sourcepub fn insert(&mut self, direction: Direction, hash: &[u8; 32])
pub fn insert(&mut self, direction: Direction, hash: &[u8; 32])
Insert a new node into the tree, the direction determines whether or not we should be flipping the stack order when we’re trying to rebuild the tree later on (on the client side).
§Panics
If called more than the number of times specified when it got constructed.
Auto Trait Implementations§
impl Freeze for ProofEncoder
impl RefUnwindSafe for ProofEncoder
impl Send for ProofEncoder
impl Sync for ProofEncoder
impl Unpin for ProofEncoder
impl UnwindSafe for ProofEncoder
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