luaur-analysis 0.1.3

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::type_aliases::blocked_constraint_id::BlockedConstraintId;
use luaur_common::records::dense_hash_table::DenseHasher;

// C++ (ConstraintGraph.h:21-24): a hash functor over BlockedConstraintId;
// `operator()` is implemented in ConstraintGraph.cpp as its own method node.
#[derive(Debug, Clone, Copy, Default)]
pub struct HashBlockedConstraintId;

// Bridge the C++ `Hash` template parameter (`HashBlockedConstraintId`) to the
// `DenseHasher` trait the `DenseHashMap` port is generic over. The hash itself
// lives in the `operator_call` method node.
impl DenseHasher<BlockedConstraintId> for HashBlockedConstraintId {
    fn hash(&self, key: &BlockedConstraintId) -> usize {
        self.operator_call(key)
    }
}