Struct bridgetree::Checkpoint
source · pub struct Checkpoint<C> { /* private fields */ }Expand description
A data structure used to store the information necessary to “rewind” the state of a
BridgeTree to a particular leaf position.
This is needed because the BridgeTree::marked_indices map is a cache of information that
crosses MerkleBridge boundaries, and so it is not sufficient to just truncate the list of
bridges; instead, we use Checkpoint values to be able to rapidly restore the cache to its
previous state.
Implementations§
source§impl<C> Checkpoint<C>
impl<C> Checkpoint<C>
sourcepub fn from_parts(
id: C,
bridges_len: usize,
marked: BTreeSet<Position>,
forgotten: BTreeSet<Position>
) -> Self
pub fn from_parts( id: C, bridges_len: usize, marked: BTreeSet<Position>, forgotten: BTreeSet<Position> ) -> Self
Creates a new checkpoint from its constituent parts.
sourcepub fn at_length(bridges_len: usize, id: C) -> Self
pub fn at_length(bridges_len: usize, id: C) -> Self
Creates a new empty checkpoint for the specified BridgeTree state.
sourcepub fn bridges_len(&self) -> usize
pub fn bridges_len(&self) -> usize
Returns the length of the BridgeTree::prior_bridges vector of the BridgeTree to
which this checkpoint refers.
This is the number of bridges that will be retained in the event of a rewind to this checkpoint.
Trait Implementations§
source§impl<C: Clone> Clone for Checkpoint<C>
impl<C: Clone> Clone for Checkpoint<C>
source§fn clone(&self) -> Checkpoint<C>
fn clone(&self) -> Checkpoint<C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<C: Debug> Debug for Checkpoint<C>
impl<C: Debug> Debug for Checkpoint<C>
source§impl<C: PartialEq> PartialEq<Checkpoint<C>> for Checkpoint<C>
impl<C: PartialEq> PartialEq<Checkpoint<C>> for Checkpoint<C>
source§fn eq(&self, other: &Checkpoint<C>) -> bool
fn eq(&self, other: &Checkpoint<C>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<C: Eq> Eq for Checkpoint<C>
impl<C> StructuralEq for Checkpoint<C>
impl<C> StructuralPartialEq for Checkpoint<C>
Auto Trait Implementations§
impl<C> RefUnwindSafe for Checkpoint<C>where C: RefUnwindSafe,
impl<C> Send for Checkpoint<C>where C: Send,
impl<C> Sync for Checkpoint<C>where C: Sync,
impl<C> Unpin for Checkpoint<C>where C: Unpin,
impl<C> UnwindSafe for Checkpoint<C>where C: 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