Struct merkle_search_tree::diff::PageRangeSnapshot
source · pub struct PageRangeSnapshot<K>(_);Expand description
An owned point-in-time snapshot of the PageRange returned from a call to
MerkleSearchTree::serialise_page_ranges().
A PageRangeSnapshot clones all PageRange bounding keys, and
therefore can only be generated if the key type K implements Clone.
let mut t = MerkleSearchTree::default();
t.upsert("bananas", &42);
// Rehash the tree before generating the page ranges
let _ = t.root_hash();
// Generate the hashes & page ranges, immutably borrowing the tree
let ranges = t.serialise_page_ranges().unwrap();
// Obtain an owned PageRangeSnapshot from the borrowed PageRange, in turn
// releasing the immutable reference to the tree.
let snap = PageRangeSnapshot::from(ranges);
// The tree is now mutable again.
t.upsert("platanos", &42);Implementations§
source§impl<K> PageRangeSnapshot<K>
impl<K> PageRangeSnapshot<K>
Trait Implementations§
source§impl<K: Clone> Clone for PageRangeSnapshot<K>
impl<K: Clone> Clone for PageRangeSnapshot<K>
source§fn clone(&self) -> PageRangeSnapshot<K>
fn clone(&self) -> PageRangeSnapshot<K>
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<K: Debug> Debug for PageRangeSnapshot<K>
impl<K: Debug> Debug for PageRangeSnapshot<K>
source§impl<K: PartialEq> PartialEq<PageRangeSnapshot<K>> for PageRangeSnapshot<K>
impl<K: PartialEq> PartialEq<PageRangeSnapshot<K>> for PageRangeSnapshot<K>
source§fn eq(&self, other: &PageRangeSnapshot<K>) -> bool
fn eq(&self, other: &PageRangeSnapshot<K>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<K> StructuralPartialEq for PageRangeSnapshot<K>
Auto Trait Implementations§
impl<K> RefUnwindSafe for PageRangeSnapshot<K>where K: RefUnwindSafe,
impl<K> Send for PageRangeSnapshot<K>where K: Send,
impl<K> Sync for PageRangeSnapshot<K>where K: Sync,
impl<K> Unpin for PageRangeSnapshot<K>where K: Unpin,
impl<K> UnwindSafe for PageRangeSnapshot<K>where K: 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