but rust suppose not to use const global variables and i get error trying to make one (non const function for const variable). I inclined to think there are possible ways to do it without allocating map every time function check was called, but i have not enough knowledge to implement this.
To avoid a global, consider creating an Arc<HashSet<u64>> if it is immutable, or Arc<RwLock<HashSet<u64>>> if it must be mutable. And pass this to where it is needed.
You can call Arc::clone if you need multiple "handles" in different threads. If it is only accessed by one thread, but you still need multiple "handles", use Rc instead of Arc. Cloning Arc or Rc will just increment its reference count, it will not copy/clone the HashSet.
If you must use a global, use a static variable and initialize it with OnceLock. I don't think you can create a constHashSet, just because there are probably none currently implemented.