Struct HashIndex
pub struct HashIndex<'a> { /* private fields */ }Expand description
A unique hash index over a borrowed slice of Values.
Keys are extracted from each value using a set of Projections. The key is
the composite of the projected field values. Only equality lookup is supported.
Both construction and lookup are O(1) amortized (hash map operations).
§Uniqueness
The index assumes each extracted key is unique across the source slice. A
debug_assert! fires on duplicate keys at build time.
§Cloning
Key fields are cloned into owned Values for use as map keys. Full records
are never cloned — the map values are &'a Value references into the source slice.
Implementations§
§impl<'a> HashIndex<'a>
impl<'a> HashIndex<'a>
pub fn new(values: &'a [Value], projections: &[Projection]) -> HashIndex<'a>
pub fn new(values: &'a [Value], projections: &[Projection]) -> HashIndex<'a>
Build an index over values, keyed by the fields selected by projections.
Each projection navigates into a value to extract one key component. Multiple projections produce a composite key compared lexicographically.