kaon/common/hash.rs
1use std::hash::{Hasher, Hash};
2
3/// Marks a function as a method.
4pub const METHOD: &str = "method";
5/// Marks a function as a static method.
6pub const STATIC: &str = "static";
7/// Marks a function as a class constructor.
8pub const INIT: &str = "init";
9
10/// Calculate a key hash form a given name and modifier.
11pub fn calculate_hash(fun_name: &str, modifier: &str) -> u64 {
12 let s = &mut ahash::AHasher::default();
13
14 fun_name.hash(s);
15 modifier.hash(s);
16
17 s.finish()
18}