1#![doc = include_str!("../README.md")]
2
3mod parse;
4mod prove;
5
6pub use logic_eval_util::str::Str;
9pub use parse::{
10 inner::VAR_PREFIX,
11 inner::{Parse, parse_str},
12 repr::{Clause, ClauseDataset, Expr, Predicate, Term},
13 text::Name,
14};
15pub use prove::{db::Database, prover::ProveCx};
16
17#[cfg(not(test))]
20pub(crate) type Map<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;
21
22#[cfg(test)]
23pub(crate) type Map<K, V> = std::collections::HashMap<K, V, FixedState>;
24
25#[cfg(test)]
26#[derive(Default, Clone, Copy)]
27struct FixedState;
28
29#[cfg(test)]
30impl std::hash::BuildHasher for FixedState {
31 type Hasher = std::hash::DefaultHasher;
32 fn build_hasher(&self) -> Self::Hasher {
33 std::hash::DefaultHasher::new()
34 }
35}
36
37#[derive(Default, Clone, Copy)]
38struct PassThroughHasher {
39 hash: u64,
40}
41
42impl std::hash::Hasher for PassThroughHasher {
43 fn write(&mut self, _bytes: &[u8]) {
44 panic!("u64 is only allowed");
45 }
46
47 fn write_u64(&mut self, i: u64) {
48 self.hash = i;
49 }
50
51 fn finish(&self) -> u64 {
52 self.hash
53 }
54}
55
56pub(crate) type NoHashState = std::hash::BuildHasherDefault<PassThroughHasher>;
57
58pub(crate) type Result<T> = std::result::Result<T, Error>;
59pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;