mod bucket;
mod buffer;
mod simple;
mod string;
#[cfg(feature = "backends")]
pub use self::{
bucket::BucketBackend,
buffer::BufferBackend,
simple::SimpleBackend,
string::StringBackend,
};
use crate::Symbol;
#[cfg(not(feature = "backends"))]
pub struct NoBackend<S>(core::marker::PhantomData<S>);
cfg_if::cfg_if! {
if #[cfg(feature = "backends")] {
pub type DefaultBackend<S> = StringBackend<S>;
} else {
pub type DefaultBackend<S> = NoBackend<S>;
}
}
pub trait Backend: Default {
type Symbol: Symbol;
fn with_capacity(cap: usize) -> Self;
fn intern(&mut self, string: &str) -> Self::Symbol;
#[inline]
fn intern_static(&mut self, string: &'static str) -> Self::Symbol {
self.intern(string)
}
fn shrink_to_fit(&mut self);
fn resolve(&self, symbol: Self::Symbol) -> Option<&str>;
unsafe fn resolve_unchecked(&self, symbol: Self::Symbol) -> &str;
}