Skip to main content

luaur_analysis/records/
hash_blocked_constraint_id.rs

1use crate::type_aliases::blocked_constraint_id::BlockedConstraintId;
2use luaur_common::records::dense_hash_table::DenseHasher;
3
4// C++ (ConstraintGraph.h:21-24): a hash functor over BlockedConstraintId;
5// `operator()` is implemented in ConstraintGraph.cpp as its own method node.
6#[derive(Debug, Clone, Copy, Default)]
7pub struct HashBlockedConstraintId;
8
9// Bridge the C++ `Hash` template parameter (`HashBlockedConstraintId`) to the
10// `DenseHasher` trait the `DenseHashMap` port is generic over. The hash itself
11// lives in the `operator_call` method node.
12impl DenseHasher<BlockedConstraintId> for HashBlockedConstraintId {
13    fn hash(&self, key: &BlockedConstraintId) -> usize {
14        self.operator_call(key)
15    }
16}