Skip to main content

intern_static

Macro intern_static 

Source
macro_rules! intern_static {
    ($ty:ty, $lit:literal) => { ... };
}
Expand description

Intern a string literal once and return the cached value on subsequent calls.

Use for hot paths that produce the same interned identifier every call. Without this, each call hashes the literal and locks the global interner, which adds up on per-frame invocations from visualizer execute methods, codegen accessors, etc.

$ty must be a type declared via declare_new_type! (or anything constructible via From<&'static str>).

fn identifier() -> ViewSystemIdentifier {
    re_string_interner::intern_static!(ViewSystemIdentifier, "Ellipsoids3D")
}