litcheck_core/
lib.rs

1pub mod diagnostics;
2pub mod fs;
3mod input;
4pub mod range;
5pub mod text;
6pub mod variables;
7
8pub use self::input::Input;
9
10pub type StaticCow<T> = std::borrow::Cow<'static, T>;
11
12pub type Symbol = string_interner::DefaultSymbol;
13
14pub struct StringInterner(
15    string_interner::StringInterner<
16        string_interner::backend::StringBackend<Symbol>,
17        core::hash::BuildHasherDefault<rustc_hash::FxHasher>,
18    >,
19);
20impl Default for StringInterner {
21    fn default() -> Self {
22        Self(string_interner::StringInterner::new())
23    }
24}
25impl StringInterner {
26    #[inline]
27    pub fn new() -> Self {
28        Self::default()
29    }
30
31    #[inline]
32    pub fn get_or_intern(&mut self, s: impl AsRef<str>) -> Symbol {
33        self.0.get_or_intern(s)
34    }
35
36    #[track_caller]
37    pub fn resolve(&self, symbol: Symbol) -> &str {
38        self.0.resolve(symbol).expect("invalid symbol")
39    }
40}