pub(super) enum NestedHits {
Some(Vec<u16>),
NoneButNamed,
Unrelated,
}
pub(super) fn nested_hits(
names: &[NestedName],
column: &[u8],
qualifier: Option<&[u8]>,
) -> NestedHits {
let named_table = qualifier.is_none_or(|wanted| names.iter().any(|held| held.table == wanted));
if !named_table {
return NestedHits::Unrelated;
}
let hits: Vec<u16> = names
.iter()
.filter(|held| held.column == column && qualifier.is_none_or(|wanted| held.table == wanted))
.map(|held| held.index)
.collect();
if hits.is_empty() {
NestedHits::NoneButNamed
} else {
NestedHits::Some(hits)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct NestedName {
pub table: Vec<u8>,
pub column: Vec<u8>,
pub index: u16,
}