pub struct CompleteTree<H, C: Ord, const DEPTH: u8> { /* private fields */ }
Available on crate feature test-dependencies only.

Implementations§

source§

impl<H: Hashable, C: Clone + Ord + Debug, const DEPTH: u8> CompleteTree<H, C, DEPTH>

source

pub fn new(max_checkpoints: usize) -> Self

Creates a new, empty binary tree

Trait Implementations§

source§

impl<H: Clone, C: Clone + Ord, const DEPTH: u8> Clone for CompleteTree<H, C, DEPTH>

source§

fn clone(&self) -> CompleteTree<H, C, DEPTH>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<H: Debug, C: Debug + Ord, const DEPTH: u8> Debug for CompleteTree<H, C, DEPTH>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<H: Hashable + PartialEq + Clone, C: Ord + Clone + Debug, const DEPTH: u8> Tree<H, C> for CompleteTree<H, C, DEPTH>

source§

fn depth(&self) -> u8

Returns the depth of the tree.
source§

fn append(&mut self, value: H, retention: Retention<C>) -> bool

Appends a new value to the tree at the next available slot. Returns true if successful and false if the tree would exceed the maximum allowed depth.
source§

fn current_position(&self) -> Option<Position>

Returns the most recently appended leaf value.
source§

fn marked_positions(&self) -> BTreeSet<Position>

Return a set of all the positions for which we have marked.
source§

fn get_marked_leaf(&self, position: Position) -> Option<H>

Returns the leaf at the specified position if the tree can produce a witness for it.
source§

fn root(&self, checkpoint_depth: usize) -> Option<H>

Obtains the root of the Merkle tree at the specified checkpoint depth by hashing against empty nodes up to the maximum height of the tree. Returns None if there are not enough checkpoints available to reach the requested checkpoint depth.
source§

fn witness(&self, position: Position, checkpoint_depth: usize) -> Option<Vec<H>>

Obtains a witness for the value at the specified leaf position, as of the tree state at the given checkpoint depth. Returns None if there is no witness information for the requested position or if no checkpoint is available at the specified depth.
source§

fn remove_mark(&mut self, position: Position) -> bool

Marks the value at the specified position as a value we’re no longer interested in maintaining a mark for. Returns true if successful and false if we were already not maintaining a mark at this position.
source§

fn checkpoint(&mut self, id: C) -> bool

Creates a new checkpoint for the current tree state. Read more
source§

fn rewind(&mut self) -> bool

Rewinds the tree state to the previous checkpoint, and then removes that checkpoint record. Read more

Auto Trait Implementations§

§

impl<H, C, const DEPTH: u8> Freeze for CompleteTree<H, C, DEPTH>

§

impl<H, C, const DEPTH: u8> RefUnwindSafe for CompleteTree<H, C, DEPTH>

§

impl<H, C, const DEPTH: u8> Send for CompleteTree<H, C, DEPTH>
where C: Send, H: Send,

§

impl<H, C, const DEPTH: u8> Sync for CompleteTree<H, C, DEPTH>
where C: Sync, H: Sync,

§

impl<H, C, const DEPTH: u8> Unpin for CompleteTree<H, C, DEPTH>
where H: Unpin,

§

impl<H, C, const DEPTH: u8> UnwindSafe for CompleteTree<H, C, DEPTH>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V