2020-11-22 00:38:24 +00:00
|
|
|
pub use ahash::AHasher;
|
2020-08-29 00:08:51 +00:00
|
|
|
use ahash::RandomState;
|
2020-11-22 00:38:24 +00:00
|
|
|
pub use instant::{Duration, Instant};
|
2020-10-20 00:29:31 +00:00
|
|
|
use std::{future::Future, pin::Pin};
|
2020-11-13 01:23:57 +00:00
|
|
|
pub use tracing;
|
2020-11-28 00:39:59 +00:00
|
|
|
pub use uuid::Uuid;
|
2020-08-29 00:08:51 +00:00
|
|
|
|
2020-10-21 22:55:15 +00:00
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
2020-10-20 00:29:31 +00:00
|
|
|
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
|
2020-10-21 22:55:15 +00:00
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
|
|
|
|
|
2021-01-12 21:21:45 +00:00
|
|
|
/// A hasher builder that will create a fixed hasher.
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct FixedState;
|
|
|
|
|
|
|
|
impl std::hash::BuildHasher for FixedState {
|
|
|
|
type Hasher = AHasher;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn build_hasher(&self) -> AHasher {
|
2021-01-20 22:24:57 +00:00
|
|
|
AHasher::new_with_keys(
|
|
|
|
0b1001010111101110000001001100010000000011001001101011001001111000,
|
|
|
|
0b1100111101101011011110001011010100000100001111100011010011010101,
|
|
|
|
)
|
2021-01-12 21:21:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-11 01:06:55 +00:00
|
|
|
/// A std hash map implementing AHash, a high speed keyed hashing algorithm
|
|
|
|
/// intended for use in in-memory hashmaps.
|
|
|
|
///
|
|
|
|
/// AHash is designed for performance and is NOT cryptographically secure.
|
2020-08-29 00:08:51 +00:00
|
|
|
pub type HashMap<K, V> = std::collections::HashMap<K, V, RandomState>;
|
|
|
|
|
2021-01-12 21:21:45 +00:00
|
|
|
/// A stable std hash map implementing AHash, a high speed keyed hashing algorithm
|
|
|
|
/// intended for use in in-memory hashmaps.
|
|
|
|
///
|
|
|
|
/// Unlike [`HashMap`] this has an iteration order that only depends on the order
|
|
|
|
/// of insertions and deletions and not a random source.
|
|
|
|
///
|
|
|
|
/// AHash is designed for performance and is NOT cryptographically secure.
|
|
|
|
pub type StableHashMap<K, V> = std::collections::HashMap<K, V, FixedState>;
|
2020-11-11 01:06:55 +00:00
|
|
|
|
|
|
|
/// A std hash set implementing AHash, a high speed keyed hashing algorithm
|
|
|
|
/// intended for use in in-memory hashmaps.
|
|
|
|
///
|
|
|
|
/// AHash is designed for performance and is NOT cryptographically secure.
|
|
|
|
pub type HashSet<K> = std::collections::HashSet<K, RandomState>;
|
|
|
|
|
2021-01-12 21:21:45 +00:00
|
|
|
/// A stable std hash set implementing AHash, a high speed keyed hashing algorithm
|
|
|
|
/// intended for use in in-memory hashmaps.
|
|
|
|
///
|
|
|
|
/// Unlike [`HashSet`] this has an iteration order that only depends on the order
|
|
|
|
/// of insertions and deletions and not a random source.
|
|
|
|
///
|
|
|
|
/// AHash is designed for performance and is NOT cryptographically secure.
|
|
|
|
pub type StableHashSet<K> = std::collections::HashSet<K, FixedState>;
|