pub struct ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>{ /* private fields */ }Expand description
A Zipper type that moves through a Cartesian product trie created by extending each path in a primary trie with the root of the next secondardary trie, doing it recursively for all provided tries
Compared to ProductZipper, this is a generic virtual zipper that works without
inspecting the inner workings of primary and secondary zippers. ProductZipperG is more general,
while ProductZipper is faster in situations where it can be used.
NOTE: In the future, this generic type will be renamed to ProductZipper, and the existing
ProductZipper will be renamed something else or removed entirely.
Implementations§
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
Sourcepub fn new<ZipperList>(primary: PrimaryZ, other_zippers: ZipperList) -> Selfwhere
ZipperList: IntoIterator<Item = SecondaryZ>,
PrimaryZ: ZipperValues<V>,
SecondaryZ: ZipperValues<V>,
pub fn new<ZipperList>(primary: PrimaryZ, other_zippers: ZipperList) -> Selfwhere
ZipperList: IntoIterator<Item = SecondaryZ>,
PrimaryZ: ZipperValues<V>,
SecondaryZ: ZipperValues<V>,
Creates a new ProductZipper from the provided zippers
Trait Implementations§
Source§impl<V: Clone + Send + Sync + Unpin, PrimaryZ, SecondaryZ> Debug for ProductZipperG<'_, PrimaryZ, SecondaryZ, V>where
PrimaryZ: ZipperAbsolutePath,
SecondaryZ: ZipperAbsolutePath,
impl<V: Clone + Send + Sync + Unpin, PrimaryZ, SecondaryZ> Debug for ProductZipperG<'_, PrimaryZ, SecondaryZ, V>where
PrimaryZ: ZipperAbsolutePath,
SecondaryZ: ZipperAbsolutePath,
Source§impl<'trie, PrimaryZ, SecondaryZ, V> Zipper for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> Zipper for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
Source§fn path_exists(&self) -> bool
fn path_exists(&self) -> bool
Returns
true if the zipper’s focus is on a path within the trie, otherwise falseSource§fn is_val(&self) -> bool
fn is_val(&self) -> bool
Returns
true if there is a value at the zipper’s focus, otherwise falseSource§fn child_count(&self) -> usize
fn child_count(&self) -> usize
Returns the number of child branches from the focus node Read more
Source§fn child_mask(&self) -> ByteMask
fn child_mask(&self) -> ByteMask
Returns 256-bit mask indicating which children exist from the branch at the zipper’s focus Read more
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperAbsolutePath for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperAbsolutePath for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperConcrete for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperConcrete,
SecondaryZ: ZipperMoving + ZipperConcrete,
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperConcrete for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperConcrete,
SecondaryZ: ZipperMoving + ZipperConcrete,
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperIteration for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperIteration for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
Source§fn to_next_val(&mut self) -> bool
fn to_next_val(&mut self) -> bool
Systematically advances to the next value accessible from the zipper, traversing in a depth-first
order Read more
Source§fn descend_last_path(&mut self) -> bool
fn descend_last_path(&mut self) -> bool
Descends the zipper to the end of the last path (last by sort order) reachable by descent
from the current focus. Read more
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperMoving for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperMoving for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
Source§fn at_root(&self) -> bool
fn at_root(&self) -> bool
Returns
true if the zipper’s focus is at its root, and it cannot ascend further, otherwise returns falseSource§fn val_count(&self) -> usize
fn val_count(&self) -> usize
Returns the total number of values contained at and below the zipper’s focus, including the focus itself Read more
Source§fn descend_to_existing<K: AsRef<[u8]>>(&mut self, path: K) -> usize
fn descend_to_existing<K: AsRef<[u8]>>(&mut self, path: K) -> usize
Moves the zipper deeper into the trie, following the path specified by
k, relative to the current
zipper focus. Descent stops at the point where the path does not exist Read moreSource§fn descend_to<K: AsRef<[u8]>>(&mut self, path: K)
fn descend_to<K: AsRef<[u8]>>(&mut self, path: K)
Moves the zipper deeper into the trie, to the
key specified relative to the current zipper focusSource§fn descend_to_byte(&mut self, k: u8)
fn descend_to_byte(&mut self, k: u8)
Moves the zipper one byte deeper into the trie. Identical in effect to descend_to
with a 1-byte key argument
Source§fn descend_indexed_byte(&mut self, child_idx: usize) -> bool
fn descend_indexed_byte(&mut self, child_idx: usize) -> bool
Descends the zipper’s focus one byte into a child branch uniquely identified by
child_idx Read moreSource§fn descend_first_byte(&mut self) -> bool
fn descend_first_byte(&mut self) -> bool
Descends the zipper’s focus one step into the first child branch in a depth-first traversal Read more
Source§fn descend_until(&mut self) -> bool
fn descend_until(&mut self) -> bool
Descends the zipper’s focus until a branch or a value is encountered. Returns
true if the focus
moved otherwise returns false Read moreSource§fn to_next_sibling_byte(&mut self) -> bool
fn to_next_sibling_byte(&mut self) -> bool
Moves the zipper’s focus to the next sibling byte with the same parent Read more
Source§fn to_prev_sibling_byte(&mut self) -> bool
fn to_prev_sibling_byte(&mut self) -> bool
Moves the zipper’s focus to the previous sibling byte with the same parent Read more
Source§fn ascend_byte(&mut self) -> bool
fn ascend_byte(&mut self) -> bool
Ascends the zipper up a single byte. Equivalent to passing
1 to ascendSource§fn ascend_until(&mut self) -> bool
fn ascend_until(&mut self) -> bool
Ascends the zipper to the nearest upstream branch point or value. Returns
true if the zipper
focus moved upwards, otherwise returns false if the zipper was already at the root Read moreSource§fn ascend_until_branch(&mut self) -> bool
fn ascend_until_branch(&mut self) -> bool
Ascends the zipper to the nearest upstream branch point, skipping over values along the way. Returns
true if the zipper focus moved upwards, otherwise returns false if the zipper was already at the
root Read moreSource§fn move_to_path<K: AsRef<[u8]>>(&mut self, path: K) -> usize
fn move_to_path<K: AsRef<[u8]>>(&mut self, path: K) -> usize
Moves the zipper’s focus to a specific location specified by
path, relative to the zipper’s root Read moreSource§fn descend_to_check<K: AsRef<[u8]>>(&mut self, k: K) -> bool
fn descend_to_check<K: AsRef<[u8]>>(&mut self, k: K) -> bool
Fused
descend_to and path_exists. Moves the
focus and returns whether or not the path exists at the new focus locationSource§fn descend_to_val<K: AsRef<[u8]>>(&mut self, k: K) -> usize
fn descend_to_val<K: AsRef<[u8]>>(&mut self, k: K) -> usize
Moves the zipper deeper into the trie, following the path specified by
k, relative to the current
zipper focus. Descent stops if a value is encountered or if the path ceases to exist. Read moreSource§fn descend_to_value<K: AsRef<[u8]>>(&mut self, k: K) -> usize
fn descend_to_value<K: AsRef<[u8]>>(&mut self, k: K) -> usize
👎Deprecated
Deprecated alias for ZipperMoving::descend_to_val
Source§fn descend_to_existing_byte(&mut self, k: u8) -> bool
fn descend_to_existing_byte(&mut self, k: u8) -> bool
Moves the zipper one byte deeper into the trie, if the specified path byte exists in the
child_mask. Read moreSource§fn descend_indexed_branch(&mut self, idx: usize) -> bool
fn descend_indexed_branch(&mut self, idx: usize) -> bool
👎Deprecated
A deprecated alias for ZipperMoving::descend_indexed_byte
Source§fn descend_last_byte(&mut self) -> bool
fn descend_last_byte(&mut self) -> bool
Descends the zipper’s focus one step into the last child branch Read more
Source§fn to_next_step(&mut self) -> bool
fn to_next_step(&mut self) -> bool
Advances the zipper to visit every existing path within the trie in a depth-first order Read more
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperPathBuffer for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperPathBuffer,
SecondaryZ: ZipperMoving + ZipperPathBuffer,
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperPathBuffer for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperPathBuffer,
SecondaryZ: ZipperMoving + ZipperPathBuffer,
Source§unsafe fn origin_path_assert_len(&self, len: usize) -> &[u8] ⓘ
unsafe fn origin_path_assert_len(&self, len: usize) -> &[u8] ⓘ
Internal method to get the path, beyond its length. Panics if
len > the path’s capacity, or
if the zipper is relative and doesn’t have an origin_path Read moreSource§fn prepare_buffers(&mut self)
fn prepare_buffers(&mut self)
Make sure the path buffer is allocated, to facilitate zipper movement
Source§impl<'trie, PZ, SZ, V: TrieValue> ZipperProduct for ProductZipperG<'trie, PZ, SZ, V>where
PZ: ZipperMoving + Zipper + ZipperAbsolutePath + ZipperIteration,
SZ: ZipperMoving + Zipper + ZipperAbsolutePath + ZipperIteration,
impl<'trie, PZ, SZ, V: TrieValue> ZipperProduct for ProductZipperG<'trie, PZ, SZ, V>where
PZ: ZipperMoving + Zipper + ZipperAbsolutePath + ZipperIteration,
SZ: ZipperMoving + Zipper + ZipperAbsolutePath + ZipperIteration,
Source§fn focus_factor(&self) -> usize
fn focus_factor(&self) -> usize
Returns the index of the factor containing the
ProductZipper focus Read moreSource§fn factor_count(&self) -> usize
fn factor_count(&self) -> usize
Returns the number of factors composing the
ProductZipper Read moreSource§fn path_indices(&self) -> &[usize]
fn path_indices(&self) -> &[usize]
Returns a slice of the path indices that represent the end-points of the portion of the path from each
factor Read more
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperReadOnlyConditionalValues<'trie, V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperReadOnlyConditionalValues<'trie, V>,
SecondaryZ: ZipperMoving + ZipperReadOnlyConditionalValues<'trie, V>,
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperReadOnlyConditionalValues<'trie, V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperReadOnlyConditionalValues<'trie, V>,
SecondaryZ: ZipperMoving + ZipperReadOnlyConditionalValues<'trie, V>,
Source§type WitnessT = (<PrimaryZ as ZipperReadOnlyConditionalValues<'trie, V>>::WitnessT, Vec<<SecondaryZ as ZipperReadOnlyConditionalValues<'trie, V>>::WitnessT>)
type WitnessT = (<PrimaryZ as ZipperReadOnlyConditionalValues<'trie, V>>::WitnessT, Vec<<SecondaryZ as ZipperReadOnlyConditionalValues<'trie, V>>::WitnessT>)
The type that acts as a witness for the validity of the zipper
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperReadOnlyValues<'trie, V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperReadOnlyValues<'trie, V>,
SecondaryZ: ZipperMoving + ZipperReadOnlyValues<'trie, V>,
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperReadOnlyValues<'trie, V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperReadOnlyValues<'trie, V>,
SecondaryZ: ZipperMoving + ZipperReadOnlyValues<'trie, V>,
Source§impl<'trie, PrimaryZ, SecondaryZ, V> ZipperValues<V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperValues<V>,
SecondaryZ: ZipperMoving + ZipperValues<V>,
impl<'trie, PrimaryZ, SecondaryZ, V> ZipperValues<V> for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
V: Clone + Send + Sync,
PrimaryZ: ZipperMoving + ZipperValues<V>,
SecondaryZ: ZipperMoving + ZipperValues<V>,
Auto Trait Implementations§
impl<'trie, PrimaryZ, SecondaryZ, V> Freeze for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>where
PrimaryZ: Freeze,
impl<'trie, PrimaryZ, SecondaryZ, V> RefUnwindSafe for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> Send for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> Sync for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> Unpin for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
impl<'trie, PrimaryZ, SecondaryZ, V> UnwindSafe for ProductZipperG<'trie, PrimaryZ, SecondaryZ, V>
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
Source§impl<'a, Z, V> Catamorphism<V> for Zwhere
V: 'a,
Z: Zipper + ZipperReadOnlyConditionalValues<'a, V> + ZipperConcrete + ZipperAbsolutePath + ZipperPathBuffer,
impl<'a, Z, V> Catamorphism<V> for Zwhere
V: 'a,
Z: Zipper + ZipperReadOnlyConditionalValues<'a, V> + ZipperConcrete + ZipperAbsolutePath + ZipperPathBuffer,
Source§fn into_cata_side_effect_fallible<W, Err, AlgF>(
self,
alg_f: AlgF,
) -> Result<W, Err>
fn into_cata_side_effect_fallible<W, Err, AlgF>( self, alg_f: AlgF, ) -> Result<W, Err>
Allows the closure to return an error, stopping traversal immediately Read more
Source§fn into_cata_jumping_side_effect_fallible<W, Err, AlgF>(
self,
alg_f: AlgF,
) -> Result<W, Err>
fn into_cata_jumping_side_effect_fallible<W, Err, AlgF>( self, alg_f: AlgF, ) -> Result<W, Err>
Allows the closure to return an error, stopping traversal immediately Read more
Source§fn into_cata_cached_fallible<W, E, AlgF>(self, alg_f: AlgF) -> Result<W, E>
fn into_cata_cached_fallible<W, E, AlgF>(self, alg_f: AlgF) -> Result<W, E>
Allows the closure to return an error, stopping traversal immediately Read more
Source§fn into_cata_jumping_cached_fallible<W, E, AlgF>(
self,
alg_f: AlgF,
) -> Result<W, E>
fn into_cata_jumping_cached_fallible<W, E, AlgF>( self, alg_f: AlgF, ) -> Result<W, E>
Allows the closure to return an error, stopping traversal immediately Read more
Source§fn into_cata_side_effect<W, AlgF>(self, alg_f: AlgF) -> W
fn into_cata_side_effect<W, AlgF>(self, alg_f: AlgF) -> W
Applies a “stepping” catamorphism to the trie descending from the zipper’s root, running the
alg_f at every
step (at every byte) Read moreSource§fn into_cata_jumping_side_effect<W, AlgF>(self, alg_f: AlgF) -> W
fn into_cata_jumping_side_effect<W, AlgF>(self, alg_f: AlgF) -> W
Applies a “jumping” catamorphism to the trie Read more
Source§fn into_cata_cached<W, AlgF>(self, alg_f: AlgF) -> W
fn into_cata_cached<W, AlgF>(self, alg_f: AlgF) -> W
Applies a cached, stepping, catamorphism to the trie descending from the zipper’s
root, running the
alg_f at every step (at every byte) Read moreSource§impl<'a, Z, V> CatamorphismDebug<V> for Zwhere
V: 'a,
Z: Zipper + ZipperReadOnlyConditionalValues<'a, V> + ZipperConcrete + ZipperAbsolutePath + ZipperPathBuffer,
impl<'a, Z, V> CatamorphismDebug<V> for Zwhere
V: 'a,
Z: Zipper + ZipperReadOnlyConditionalValues<'a, V> + ZipperConcrete + ZipperAbsolutePath + ZipperPathBuffer,
Source§fn into_cata_jumping_cached_fallible_debug<W, E, AlgF>(
self,
alg_f: AlgF,
) -> Result<W, E>
fn into_cata_jumping_cached_fallible_debug<W, E, AlgF>( self, alg_f: AlgF, ) -> Result<W, E>
A version of
into_cata_jumping_cached where
the full path is available to the closure; For debugging purposes only Read more