Generic "comment to node" association logic (#4642)

This commit is contained in:
Micha Reiser 2023-05-30 11:28:01 +02:00 committed by GitHub
parent 84a5584888
commit 0cd453bdf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1574 additions and 65 deletions

View file

@ -42,6 +42,7 @@ use std::ops::Range;
/// * 1 byte for the end sequence, e.g. `\n`
///
/// Meaning, the upper bound for comments is `u32::MAX / 2`.
#[derive(Clone)]
pub(super) struct MultiMap<K, V> {
/// Lookup table to retrieve the entry for a key.
index: FxHashMap<K, Entry>,
@ -519,7 +520,7 @@ impl<V> ExactSizeIterator for PartsIterator<'_, V> {}
impl<V> FusedIterator for PartsIterator<'_, V> {}
#[derive(Debug)]
#[derive(Clone, Debug)]
enum Entry {
InOrder(InOrderEntry),
OutOfOrder(OutOfOrderEntry),
@ -586,7 +587,7 @@ where
}
}
#[derive(Debug)]
#[derive(Clone, Debug)]
struct InOrderEntry {
/// Index into the [MultiMap::parts] vector where the leading parts of this entry start
leading_start: PartIndex,
@ -709,7 +710,7 @@ impl InOrderEntry {
}
}
#[derive(Debug)]
#[derive(Clone, Debug)]
struct OutOfOrderEntry {
/// Index into the [MultiMap::out_of_order] vector at which offset the leaading vec is stored.
leading_index: usize,