cached_patterns!() { /* proc-macro */ }Expand description
Like patterns! but wraps the matcher in LazyLock for zero-cost reuse.
Returns &'static SimplifiedPatternMatcher<C> instead of an owned matcher.
The matcher is constructed only once on first call and cached globally.
Use this for stateless pm_*() functions that are called repeatedly
(e.g., once per kernel). Avoids re-constructing closures and hashmaps
on every call.
§Example
ⓘ
pub fn pm_render() -> &'static TypedPatternMatcher {
cached_patterns! { ... }
}