kermit_iters/lib.rs
1//! Core iterator traits for Kermit's relational algebra engine.
2//!
3//! This crate defines the trait hierarchy that all data structures and
4//! algorithms build upon: [`LinearIterator`] for flat sorted sequences and
5//! [`TrieIterator`] for hierarchical trie traversal. [`TrieIteratorWrapper`]
6//! adapts any `TrieIterator` into a standard `Iterator<Item = Vec<usize>>` that
7//! yields complete tuples via depth-first traversal.
8//!
9//! All keys are `usize` (dictionary-encoded); see [`Key`]. The marker trait
10//! [`JoinIterable`] unifies data structures that may participate in joins.
11//!
12//! # Example
13//!
14//! `Vec<usize>` ships with a [`LinearIterable`] implementation, useful as a
15//! minimal example of the trait:
16//!
17//! ```
18//! use kermit_iters::{LinearIterable, LinearIterator};
19//!
20//! let data = vec![1_usize, 3, 5, 7];
21//! let mut iter = data.linear_iter();
22//!
23//! // Iterators start positioned *before* the first key.
24//! assert_eq!(iter.next(), Some(1));
25//!
26//! // `seek` advances to the least upper bound of the given key.
27//! assert!(iter.seek(4));
28//! assert_eq!(iter.key(), Some(5));
29//!
30//! assert_eq!(iter.next(), Some(7));
31//! assert_eq!(iter.next(), None);
32//! assert!(iter.at_end());
33//! ```
34
35#![deny(missing_docs)]
36
37mod hash_strategy;
38mod hash_trie;
39mod joinable;
40mod key_type;
41mod linear;
42mod optimization;
43mod trie;
44
45pub use {
46 hash_strategy::{FxHashStrategy, HashStrategy, SipHashStrategy},
47 hash_trie::{HashTrieIterable, HashTrieIterator},
48 joinable::JoinIterable,
49 key_type::Key,
50 linear::{LinearIterable, LinearIterator},
51 optimization::{BuildMode, ConfigOption, HasOptimizationAxes, LayoutOption},
52 trie::{TrieIterable, TrieIterator, TrieIteratorWrapper},
53};