Skip to main content

cached_symbol

Macro cached_symbol 

Source
macro_rules! cached_symbol {
    ($(#[$meta:meta])* $vis:vis fn $name:ident() = $cstr:expr) => { ... };
}
Expand description

Cache an Rf_install symbol result.

Expands to a function that returns the cached SEXP. First call does the Rf_install; subsequent calls are a single atomic load.

cached_symbol!(pub(crate) fn tzone_symbol() = c"tzone");

// With feature gate:
cached_symbol!(#[cfg(feature = "time")] pub(crate) fn tzone_symbol() = c"tzone");