pub struct StaticInterner { /* private fields */ }Expand description
Frozen static-string interner. Built once at scanner
construction; cloneable via Arc so every rayon worker shares
one read-only instance.
index maps each interned string to its slot in arena; it is read-only
after construction, so concurrent lookups need no synchronization. The
ahash hasher gives a single fast (8-byte-word, hardware-mixed) hash per
lookup instead of the CHD perfect hash’s three per-byte hash passes.
Implementations§
Source§impl StaticInterner
impl StaticInterner
Sourcepub fn from_detector_strings<I, S>(detector_strings: I) -> Self
pub fn from_detector_strings<I, S>(detector_strings: I) -> Self
Build an interner from the universe of stable strings: detector metadata fields + the seed source-type list. Duplicates are collapsed automatically (the map keeps one entry per distinct key).
Sourcepub fn lookup(&self, s: &str) -> Option<Arc<str>>
pub fn lookup(&self, s: &str) -> Option<Arc<str>>
Single-hash lookup. Returns a clone of the pre-allocated Arc<str>
when s is in the interner; None otherwise. One ahash pass over the
key plus a bucket compare - no second hash, no separate verify pass.
Arc<str>: Borrow<str> makes get(s) allocation-free on hits.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Default for StaticInterner
impl Default for StaticInterner
Source§fn default() -> StaticInterner
fn default() -> StaticInterner
Auto Trait Implementations§
impl Freeze for StaticInterner
impl RefUnwindSafe for StaticInterner
impl Send for StaticInterner
impl Sync for StaticInterner
impl Unpin for StaticInterner
impl UnsafeUnpin for StaticInterner
impl UnwindSafe for StaticInterner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more