Skip to main content

pin

Macro pin 

Source
macro_rules! pin {
    ($s:literal) => { ... };
}
Expand description

Call-site-cached interning for string literals — the first call on a thread pins the literal via pin_static, later calls return the cached SymStr directly (thread-local OnceCell load, no arena access). Use this from hot state-key lookup sites so you can keep writing string literals at the call site and still skip the per-call pin() hash probe:

if state::lookup_bool_sym(pin!("groupNonBoxing")) { ... }

Each call site gets its own thread-local cache (no global registry, no dedicated pub-static constant per key), so there is no ergonomic cost beyond typing the macro name.

Note: the macro pin! and the runtime-string function arena::pin(s) share a name but occupy different namespaces in Rust — pin!(…) is the macro, pin(…) is the function — so both remain callable.