Skip to main content

luaur_ast/records/
entry_hash.rs

1use crate::records::entry::Entry;
2use luaur_common::records::dense_hash_table::DenseHasher;
3
4#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
5pub struct EntryHash;
6
7// The `DenseHashSet<Entry, EntryHash>` hash functor. `EntryHash::operator_call`
8// (the FNV-1a over the name bytes) lives in its own method item; this bridges it
9// to the `DenseHasher` trait the table is generic over.
10impl DenseHasher<Entry> for EntryHash {
11    fn hash(&self, key: &Entry) -> usize {
12        self.operator_call(key)
13    }
14}