use std::borrow::Borrow;
use std::hash::Hash;
#[cfg(feature = "fast")]
pub mod fast;
#[cfg(feature = "local")]
pub mod local;
#[cfg(feature = "snap")]
pub mod snap;
#[cfg(test)]
mod testing;
#[allow(unused)]
type RandomState = ahash::RandomState;
#[cfg(feature = "elysees")]
#[allow(unused)]
type Arc<T> = elysees::Arc<T>;
#[cfg(not(feature = "elysees"))]
#[allow(unused)]
type Arc<T> = std::sync::Arc<T>;
#[allow(unused)]
type Rc<T> = std::rc::Rc<T>;
pub trait SymbolMap<K> {
type Value;
fn insert(&mut self, key: K, value: Self::Value);
fn get<Q>(&self, key: &Q) -> Option<&Self::Value>
where
Q: ?Sized + Hash + Eq,
K: Borrow<Q>;
#[inline]
fn contains_key<Q>(&self, key: &Q) -> bool
where
Q: ?Sized + Hash + Eq,
K: Borrow<Q>,
{
self.get(key).is_some()
}
fn is_empty(&self) -> bool;
fn try_get_mut<Q>(&mut self, key: &Q) -> Option<&mut Self::Value>
where
Q: ?Sized + Hash + Eq,
K: Borrow<Q>;
fn push(&mut self);
fn pop(&mut self);
fn depth(&self) -> usize;
}
pub trait MutSymbolMap<K>: SymbolMap<K> {
#[inline(always)]
fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Self::Value>
where
Q: ?Sized + Hash + Eq,
K: Borrow<Q>,
{
self.try_get_mut(key)
}
}
pub trait SymbolStack<K>: SymbolMap<K> {
fn prev(&self) -> Option<&Self>;
}