Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Make cpp_expr usable without having a full PreProcessor #441

Merged
merged 15 commits into from
May 22, 2020
8 changes: 7 additions & 1 deletion src/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ use std::sync::RwLock;
use lasso::{Rodeo, Spur};
use lazy_static::lazy_static;

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct InternedStr(pub Spur);

impl fmt::Debug for InternedStr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self)
}
}

lazy_static! {
pub static ref STRINGS: RwLock<Rodeo<Spur>> = RwLock::new(Rodeo::default());
static ref EMPTY_STRING: InternedStr = InternedStr::get_or_intern("");
Expand Down
Loading