2020-08-29 00:08:51 +00:00
|
|
|
use ahash::RandomState;
|
2020-10-20 00:29:31 +00:00
|
|
|
use std::{future::Future, pin::Pin};
|
|
|
|
|
|
|
|
pub use ahash::AHasher;
|
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>>;
|
|
|
|
|
2020-08-29 00:08:51 +00:00
|
|
|
pub type HashMap<K, V> = std::collections::HashMap<K, V, RandomState>;
|
|
|
|
pub type HashSet<K> = std::collections::HashSet<K, RandomState>;
|
|
|
|
|
|
|
|
pub trait HashMapExt {
|
|
|
|
fn with_capacity(cap: usize) -> Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<K, V> HashMapExt for HashMap<K, V> {
|
|
|
|
fn with_capacity(cap: usize) -> Self {
|
|
|
|
HashMap::with_capacity_and_hasher(cap, RandomState::default())
|
|
|
|
}
|
|
|
|
}
|