Skip to main content

declare_interned_string

Macro declare_interned_string 

Source
macro_rules! declare_interned_string {
    ($var_name:ident, $str_lit:literal) => { ... };
    ($var_name:ident, $str_lit:literal, extern) => { ... };
}
Expand description

Statically declares a new InternedString.

By default, this macro allocates the string inside the special __fxt_interned_string_table linker section.

If the extern parameter is provided, the macro instead references an external symbol (e.g. C++ template-allocated) with the C++ mangled name for the string, preventing duplicate physical allocation in the linker section.

ยงExamples

Local allocation:

declare_interned_string!(MY_STRING, "hello.world");

External reference (references C++ symbol, avoids physical duplicates):

declare_interned_string!(MY_STRING, "drop_stats", extern);